Home   Easy-Code    Forum  Updater 
Twitter Facebook



Program for age and eligibility using pascal

Critics Rating:

Users Rating:

(*PROGRAM FOR AGE AND ELIGIBILITY*)

program date;

uses crt;

var

pd,pm,py,bd,bm,by,cd,cm,cy,ch:integer;

begin

clrscr;

textmode(0);

write("ENTER CURRENT DATE : ");

read(pd);

write("ENTER CURRENT MONTH : ");

read(pm);

write("ENTER CURRENT YEAR : ");

read(py);

write("ENTER YOUR BIRTH DATE : ");

read(bd);

write("ENTER YOUR BIRTH MONTH : ");

read(bm);

write("ENTER YOUR BIRTH YEAR : ");

read(by);

writeln("ARE YOU A BOY(1) OR GIRL(2) ");

read(ch);

clrscr;

cy:=py-by;

cm:=pm+12-bm;

writeln(" YOUR AGE AND ELIGIBILITY ");

writeln(" ************************ ");

writeln;

if pd=bd then

begin

writeln("DAYS = 0");

writeln("MONTHS = ",cm-12);

writeln("YEARS = ",py-by);

end;

if pd>bd then

begin

writeln(" DAYS = ",pd-bd);

if cm>=12 then

cm:=cm-12;

writeln(" MONTHS = ",cm);

writeln(" YEAR = ",cy);

end;

if pd
begin

writeln("DAYS = ",pd-bd+30);

cm:=cm-1;

writeln("MONTHS = ",cm);

if cm<12 then

writeln("YEARS = ",cy-1);

end;

case ch of

1:begin

if cy>18 then

writeln("YOU HAVE THE RIGHT TO VOTE.")

else

writeln("YOU ARE NOT HAVING THE RIGHT TO VOTE.");

if cy>21 then

writeln("YOU HAVE THE RIGHT TO MARRY.")

else

writeln("SORRY ! NO CHANCE FOR MARRIAGE.");

end;

2:begin

if cy>18 then

begin

writeln;

writeln("YOU HAVE THE RIGHT TO VOTE.");

writeln;

writeln("YOU HAVE THE RIGHT TO MARRY.");

end;

if cy<18 then

begin

writeln;

writeln("YOU ARE NOT HAVING THE RIGHT TO VOTE.");

writeln;

writeln("SORRY ! NO CHANCE FOR MARRIAGE.");

end;

end;

end;

repeat until keypressed;

end.

Courtesy, Source, References & Regards: Kishore AVGK

While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright@2009-2011 by KuGuNi.com. All Rights Reserved.