Calculates the sum of the multipication results z = 3 + x + 1/ y - 4
Delphi & Pascal (česká wiki)
Category: Homework in Pascal
Program: Func2.pas
File exe: Func2.exe
flow: Func2.gif
Program: Func2.pas
File exe: Func2.exe
flow: Func2.gif
Calculates the sum of the multipication results z = 3 + x + 1/ y - 4. Calculate is finished when entered y=4. All print in table.
{ FUNC2.PAS Copyright (c) TrSek alias Zdeno Sekerak } { Zostavte program pre vypocet hodnot funkcie Z = 3 + x + 1/ y - 4 } { Vypocet sa skonci zadanim y=4. } { Vysledky /aj nacitane x,y/ tlacte v tabulke. } { } { Datum:04.02.2004 http://www.trsek.com } program funkcia; uses crt; var x:array[1..100] of real; y:array[1..100] of real; z:array[1..100] of real; i:integer; n:integer; begin ClrScr; WriteLn('Program vypocita funkciu Z = 3+x+1/y-4'); { nacita az pokial nezada y=4 } n := 0; repeat n := n + 1; Write('Zadaj x[',n,']='); ReadLn(x[n]); Write('Zadaj y[',n,']='); ReadLn(y[n]); until (y[n] = 4); WriteLn; WriteLn('Vysledna tabulka je'); WriteLn; WriteLn('Por| X | Y | Z |'); WriteLn('-------------------------------'); for i:=1 to n-1 do begin z[i] := (3 + x[i] + 1)/(y[i]-4); WriteLn( i:3,'|', x[i]:8:3, '|', y[i]:8:3, '|', z[i]:8:3, '|' ); end; WriteLn('-------------------------------'); ReadLn; end.