Calculates the sum of the multipication results y=(2,5x-11,1) / (2x-1), when x is interval <0,3> step is K=0,5

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Category: Homework in Pascal

Program: Functab.pas
File exe: Functab.exe
flow: Functab.gif

Calculates the sum of the multipication results y=(2,5x-11,1) / (2x-1), when x is interval <0,3> step is K=0,5.
{ FUNCTAB.PAS               Copyright (c) TrSek alias Zdeno Sekerak }
{ Odladte program pre vypocet a tlac hodnot funkcie                 }
{ y=(2,5x-11,1) / (2x-1), ak x je z intervalu od 0 do 3, krok k=0,5 }
{                                                                   }
{ Datum:04.02.2004                             http://www.trsek.com }
 
program functab;
uses crt;
var x:real;
    y:real;
    delitel:real;
    krok:real;
 
begin
     ClrScr;
     WriteLn('Program vykresli tabulku pre funkciu y=(2,5x-11,1) / (2x-1)');
     WriteLn('v intervale 0 do 3, s krokom k=0,5');
     WriteLn;
     WriteLn('       x |        y |');
     WriteLn('---------------------');
 
     krok := 0.5;
     x := 0;
 
     { v cylke vypocitam a vykreslim hodnoty }
     repeat
        delitel := 2*x-1;
 
        if( delitel = 0 )Then
         begin
            WriteLn( x:8:3, ' |delenie 0 |');
         end
        else
         begin
                y := (2.5*x-11.1) / (2*x-1);
                WriteLn( x:8:3, ' | ', y:8:3, ' | ');
         end;
 
        { pridam dalsi krok }
        x := x + krok;
     until( x > 3);
 
     WriteLn('---------------------');
     ReadLn;
end.