Program Ganjil Genap Pascal
Berikut Saya Posting Program Ganjil Genap pada bahasa pemrograman pascal 1: Program ganjil_genap; 2: uses wincrt; 3: var 4: bil, i,g1,g2,j1,j2,n: integer; 5: rt1,rt2:real; 6: begin 7: write('Masukkan Banyaknya Data ' );readln(n); 8: for i := 1 to n do 9: begin 10: write('Bilangan ke:',i ,' ');readln(bil); 11: if bil mod 2 = 0 then 12: j1:=j1 +1; 13: g1:=g1+bil; 14: if bil mod 2 =1 then 15: j2:=j2+1; 16: g2:=g2+bil; 17: end; 18: rt1:=g1/j1; 19: rt2:=g2/j2; 20: writeln('Jumlah bil. Ganjil=' ,j2); 21: writeln('Jumlah bil. Genap=' ,j1); 22: writeln('Rerata Ganjil=' ,rt2:4:2); 23: writeln('Rerata Genap=' ,rt1:4:2); 24: end. Terima Kasih , Atas Kunjungannya A/n. Irwin Andriyanto