program ganjilgenap;
uses crt;
var
n,x,y,pil,jum:integer;
ulang:char;
begin
REPEAT
clrscr;
writeln('Menghitung bilangan ganjil dan genap');
writeln('------------------------------------');
writeln('PILIHAN :');
writeln('1. Bilangan GENAP');
writeln('2. Bilangan GANJIL');
write('Masukkan pilihan = ');
readln(pil);
writeln;
IF pil =1 THEN
begin
writeln('Menghitung bilangan GENAP');
writeln('*************************');
write('Masukkan banyak bilangan = ');
readln(n);
writeln('Deret bilangan genap :');
jum:=0;
y:=0;
FOR x:=1 TO n DO
begin
write(y,' ');
jum:=jum+y;
y:=y+2;
end;
writeln;
writeln('Total jumlah bilangan = ',jum)
end
ELSE IF pil = 2 THEN
begin
writeln('Menghitung bilangan GANJIL');
writeln('**************************');
write('Masukkan banyak bilangan = ');
readln(n);
writeln('Deret bilangan ganjil :');
jum:=0;
y:=1;
FOR x:=1 TO n DO
begin
...................
...................
...................
(silahkan diisi sendiri)
end
ELSE
writeln('Pilihan Anda Salah !');
writeln;
writeln('*');
writeln('*');
writeln('*');
writeln('Tekan H untuk mengakhiri');
ulang:=ReadKey;
UNTIL (ulang = 'H') OR (ulang = 'h');
END.