Age Calculator Source Code Project

 #include<stdio.h>

#include<conio.h>

void main()

{

 int d1,d2,m1,m2,y1,y2,i;

 clrscr();

 printf(" --------------------------------------------\n");

 textcolor(RED);

 cprintf(" Calculate The Age With DOB");

 printf("\n --------------------------------------------");

 printf("\n Enter Your Date Of Birth :-\n");

 printf("\n\t Day");

 scanf("%d",&d1);

 printf("\t Month");

 scanf("%d",&m1);

 printf("\t Year");

 scanf("%d",&y1);

 printf(" -------------------------------------------");

 printf("\n Enter Current Date :-\n");

 printf("\n\t Day");

 scanf("%d",&d2);

 printf("\t Month");

 scanf("%d",&m2);

 printf("\t Year");

 scanf("%d",&y2);

 printf(" --------------------------------------------\n");


 if(d1==d2 && m1==m2)

 {

  textcolor(YELLOW+BLINK);

  cprintf(" HAPPY BIRTHDAY MY DEAR");

 }

 printf("\n --------------------------------------------");

 if(d2>=d1)

 {

  d2-=d1;

 }

 else

 {

 m2--;

 d2+=30;

 d2-=d1;

 }


 if(m2>=m1)

 {

  m2-=m1;

 }

 else

 {

 y2--;

 m2+=12;

 m2-=m1;

 }

 y2-=y1;

 printf("\n Your Present AGE :-\n");

 printf("\n\t %d Year\t",y2);

 printf("\t %d Month\t",m2);

 printf("\t %d Day\t",d2);

 printf("\n --------------------------------------------");

 m2=11-m2;

 d2=30-d2;

 printf("\n Your Next Birthday Time Remain \n");

 printf("\n\t %d Month\t",m2);

 printf("\t %d Day\t",d2);

 if(m2>=6)

 {

 textcolor(BLACK+RED+BLINK);

 cprintf("Long Time Wait....");

 }

 else

 {

 textcolor(GREEN+BLINK);

 cprintf("Cooming Soon..Arrange Party");

 }



getch();

}

Previous Post Next Post