1.
Program
max-min
Langkah-langkah
:
program
max_min;
uses
crt;
var
a,b,c,min,max:integer;
begin
textcolor(yellow);
textbackground(blue);
clrscr;
writeln('*****
PROGRAM NILAI MAX & NILAI MIN *****');
writeln;
write('Masukkan
banyaknya data = ');readln(a);
min:=10000000;
max:=-1000000;
for
b:=1 to a do
begin
write('Data
ke-',b,' = ');readln(c);
if
c<=min then min:=c;
if
c>=max then max:=c;
end;
writeln('Jadi,
Nilai Min = ',min);
writeln(' Nilai Max = ',max);
readln;
end.
Hasil
RUN :
Tidak ada komentar:
Posting Komentar