"the spirit of friendship will kill fear ...... "

Sunday, November 27, 2011

For Math'10

program umur;
uses crt;
var
a,b,c,d,e,f,x,y,z: integer;
begin
clrscr;
write('Masukkan tanggal lahir : ');readln(a,b,c);
write('Masukkan tanggal hari ini : ');readln(d,e,f);
x:=d-a;
if x < 0 then
 begin
  x:=30+x;
  e:=e-1;
 end;
y:=e-b;
if y < 0 then
 begin
  y:=12+y;
  f:=f-1;
 end;
z:=f-c;
writeln('Umur anda adalah : ',z,' tahun, ',y,' bulan, ',x,' hari.');
readkey;
end.

No comments:

Post a Comment