PROGRAM deret;
USES crt;
VAR
i,j,k,n,jum1,jum2:integer;
FUNCTION der:integer;
BEGIN
writeln('Deret bilangan :');
writeln('Genap':5,'Ganjil':10);
writeln('-----':5,'------':10);
jum1:=0;jum2:=0;
j:=2;k:=1;
FOR i:=1 to n DO
BEGIN
writeln(j:3,k:10);
jum1:=jum1+j;
jum2:=jum2+k;
j:=j+2;
k:=k+2;
END;
writeln('-----':5,'------':10);
writeln(jum1:3,jum2:10);
writeln;
END;
BEGIN
clrscr;
writeln('DERET GANJIl GENAP YANG SUDAH DIAJARKAN DULU');
writeln('--------------------------------------------');
write('Masukkan banyaknya deret bilangan : ');readln(n);
writeln;
der;
readln;
END.
Tidak ada komentar:
Posting Komentar