Hendy Blog

Product

Program ganjil_genap;
uses wincrt;
var
bil,i, n,j1,j2,g1,g2: integer;
rt1,rt2:real;
ulang : char;
begin
write('Masukkan Banyaknya Data : ' );readln(n);
for i := 1 to n do
begin
write('Bilangan ke ',i ,' : ');readln(bil);
if bil mod 2 = 1 then
j1:= j1 + 1;
g1:= g1 + bil;
if bil mod 2 = 0 then
j2:= j2 + 1;
g2:= g2 + bil;
end;
rt1:=g1/j1;
rt2:=g2/j2;
writeln('Jumlah biangan Ganjil = ' ,j1);
writeln('Jumlah bilangan Genap = ' ,j2);
writeln('rata-rata data dibagi jumlah bilangan Ganjil=' ,rt1:4:2);
writeln('rata-rata data dibagi jumlah bilangan Genap=' ,rt2:4:2);
end.

Categories:

Leave a Reply