|
more than 450 programs for free
|
![]() English |
![]() Slovensky |
![]() Česky |
![]() Šarišsky |
|
Category: Homework in Pascal Program: Postup.pas File exe: Postup.exe Calculates the number, the average and the addition of positive values.
Views: 781x
{ POSTUP.PAS Copyright (c) TrSek alias Zdeno Sekerak } { Vypocita pocet, sucet a priemer kladnych cisel } { Vstup : cisla } { Vystup: pocet, suma a priemer kladnych cisel } { } { Datum:10.04.2000 http://www.trsek.com } program postupnost (input, output); var a, po, kl : integer; begin po := 0; kl := 0; writeln ('zadavaj cisla postupnosti (koniec je -999)'); repeat write ('zadaj a: '); readln (a); if a > 0 then begin po := po + 1; kl := kl + a; end; until a = -999; writeln ('pocet kladnych cisel je ', po); writeln ('sucet kladnych cisel je ', kl); writeln ('priemer kladnych cisel je ', kl/po:5:3); ReadLn; end. [Run] [Save] [Print] [Send e-mail] |
|