uses crt;
var n, i, gl, gp, max, rata, total : integer;
x : array[1..100] of integer;
next : char;
begin
clrscr;
next := 'Y';
while upcase(next) = 'Y' do
begin
clrscr;
write('Jumlah Data : '); readln(n);
gp := 0; gl := 0;
for i := 1 to n do
begin
write('Input Angka ',i,' = '); readln(x[i]);
if x[i] mod 2 = 0 then
gp := gp + x[i]
else
gl := gl + x[i];
end;
for i := 1 to n do
write(x[i]:3);
writeln;
for i := 1 to n do
if x[i] > max then
max := x[i];
write(' Angka Genap :');
for i := 1 to n do
if x[i] mod 2 = 0 then
write(x[i]:3);
writeln;
write('Angka Ganjil :');
for i := 1 to n do
if x[i] mod 2 = 1 then
write(x[i]:3);
writeln;
total := gp + gl;
rata := total div n;
writeln('Angka Maximal Adalah : ',max);
writeln('Total Ganjil : ',gl);
writeln('Rata-Rata Angka Adalah = ',rata);
writeln('Total Genap + Ganjil Adalah = ',total);
readln;
repeat
write('Masih Mau Lanjut ? [Y/T] : ');
readln(next);
until next in ['Y','T','y','t'];
end;
end.
Tidak ada komentar:
Posting Komentar