Selasa, 02 November 2010

Contoh Program Bahasa Pascal Mencari Bilangan Genap atau Ganjil

Contoh Program Bahasa Pascal Mencari Bilangan Genap atau Ganjil

uses wincrt;
var

n,tot: longint;
         
begin
clrscr;

writeln(' *Mencari Bilangan Ganjil & Total Jumlahnya*');
writeln(' ===========================================');
writeln;
write(' Masukan bilangan bulat= ');
readln(n);
writeln(' Bilangan Ganji dari 0 - ',n);           
writeln(' Adalah=');

for n:=1 to n  do  begin
if (n mod 2)>0 then
write  ('',n,',');
end;

tot:=(n mod 2)+(n div 2);
writeln; writeln;
writeln(' Semuanya ada             = ',tot,' buah.');
writeln(' Dan Total Semuanya Adalah= ',tot*tot);                                                         

end.

Preview:
Share This
Subscribe Here

0 comments :

Posting Komentar

 

Site Info

Followers

Indahnya Berbagi Copyright © 2009 BeMagazine Blogger Template is Designed by Blogger Template
In Collaboration with fifa