To fing it we must compare indeks[1] with other indeks.We can use indeks[1] (i[1]) for the reference.
We can compare the indeks with statement like this
program maksimum_minimum;uses wincrt;var i, j, maks,min,n : integer;x : array [1..100] of integer;beginwrite('Write Sum Of Data : ');readln(n);for i:= 1 to n dobeginwrite('Data[',i,'] : ');readln(x[i]);end;maks:= x[1];min := x[i]; j:=1;for j :=1 to n dobeginif x[j] > maks then maks := x[j] else maks := maks;if x[j] < min then min := x[j] else min := min;end;writeln;writeln('Sum of data : ',n);writeln('Maksimum Number : ', maks);writeln('Minimum Number : ', min);end.
And if you ran this program yau can get output loke this :

No comments:
Post a Comment