Determine minimal, maximal number of sequence
Delphi & Pascal (česká wiki)
Category: Homework in Pascal
Author: Juraj Pupák
Program: Postupno.pas
File exe: Postupno.exe
Author: Juraj Pupák
Program: Postupno.pas
File exe: Postupno.exe
Determine minimal, maximal number of sequence.
{ POSTUPNO.PAS } { Urci najmensie, najvacsie cislo zo zadanej postupnosti. } { } { Author: Juraj Pupak } { Date : 27.10.2006 http://www.trsek.com } program PostupnostCisel; uses crt; var Pole : Array [0..10000] of integer; number : integer; index : integer; max_number : integer; min_number : integer; begin clrscr; index := 0; writeln('Urci najmensie, najvacsie cislo zo zadanej postupnosti (0-koniec).'); writeln('------------------------------------------------------------------'); Repeat write('Zadaj cislo: '); readln(number); Pole[index] := number; index := index + 1; Until number = 0; index := 0; max_number := Pole[index]; Repeat IF Pole[index] > max_number THEN begin max_number := Pole[index]; end; index := index + 1; Until Pole[index] = 0; writeln('Najvacsie cislo je : ',max_number); index := 0; min_number := Pole[index]; Repeat IF Pole[index] < min_number THEN begin min_number := Pole[index]; end; index := index + 1; Until Pole[index] = 0; writeln('Najmensie cislo je : ',min_number); readln; end.