Kamis, 03 November 2011

Program Bilangan_Ganjil_Genap Pascal

Program Bilangan_Ganjil_Genap;
uses wincrt;
var
bil, b,i,a,n,x,y: integer;
begin
writeln('PROGRAM BILANGAN GANJIL');
write('Masukkan Banyaknya Data :' );readln(n);
for i := 1 to n do
begin
write('Bilangan ke',    i  ,'=');readln(bil);
if bil mod 2 = 0 then
begin
a:=a+1;
x:=x+bil;
end;
if bil mod 2 = 1 then
begin
b:=b+1;
y:=y+bil;
end;
end;
writeln('Jumlah bil. Genap=' ,a);
writeln('Total bil. Genap=' ,x);
writeln('Jumlah bil. Ganjil=' ,b);
writeln('Total bil. Ganjil=' ,y);
end.

0 komentar:

Posting Komentar

Related Posts Plugin for WordPress, Blogger...

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | JCPenney Coupons