# Age Calculator

Age Calculator or birthday calculator  is an application that can calculate our age that means how many years old you are now.

Dear learner, In this tutorial I will provide a smart & new birthday calculator cause when you run it you must say wow! what an application it is? Because My birthday calculator can find what was the name of your birth day with your current age.

So to see this imaging application you have to some work these are:

1. Open code block or other compiler that support C languages.

2. Then copy & past the following line of code

3. Then save as like birthdaycalculator.cpp

4. compile the line of code

5. Finally run the code.

Here is the program code:

```
#include<stdio.h>

int main()
{
while(1){
printf("\n -----:Birth Date Calculator:-----");
int past_day,past_month,past_year,present_day,present_month,present_year,b_day,b_month,b_year,f,d,birth_day;
printf("\n");
printf("\n Enter your present date Like: day/month/year\n");
scanf("%d/ %d/ %d",&present_day,&present_month,&present_year);
if(present_day==0 || present_month==0||present_year==0 || present_year>9999)
break;
printf("\n%d/ %d/ %d",present_day,present_month,present_year);
printf("\n\nEnter your past Birthday date Like: day/month/year\n");
scanf("%d/ %d/ %d",&past_day,&past_month,&past_year);
if(past_day==0 || past_month==0||past_year==0 ||past_year>9999)
break;
printf("\n%d/%d/ %d",past_day,past_month,past_year);

if(present_month<=past_month){
present_month=present_month+12;
present_year=present_year-1;}

if(present_day<=past_day){
present_day=present_day+30;
present_month=present_month-1;}
b_day=present_day-past_day;
b_month=present_month-past_month;
b_year=present_year-past_year;
printf("\n\n Now Your age is :\n\n%d years \n %d month(s) \n%d day(s)",b_year,b_month,b_day);
if((past_year%100==0 && past_year%400==0) || (past_year%100!=0 && past_year%4==0))
{
printf("\n%d year was lepayer\n", past_year);
if(past_month==1)

d=past_day;

else if(past_month==2)

d=(31+past_day);

else if(past_month==3)
d=(31+29+past_day);

else if(past_month==4)
d=(31+29+31+past_day);

else if(past_month==5)
d=(31+29+31+30+past_day);

else if(past_month==6)
d=(31+29+31+30+31+past_day);

else if(past_month==7)
d=(31+29+31+30+31+30+past_day);

else if(past_month==8)
d=(31+29+31+30+31+30+31+past_day);

else if(past_month==9)
d=(31+29+31+30+31+30+31+31+past_day);
else if(past_month==10)
d=(31+29+31+30+31+30+31+31+30+past_day);
else if(past_month==11)
d=(31+29+31+30+31+30+31+31+30+31+past_day);

else
d=(31+29+31+30+31+30+31+31+30+31+30+past_day);
}
else{
past_year=past_year;

if(past_month==1)
d=past_day;
else if(past_month==2)

d=(31+past_day);

else if(past_month==3)
d=(31+28+past_day);

else if(past_month==4)
d=(31+28+31+past_day);

else if(past_month==5)
d=(31+28+31+30+past_day);

else if(past_month==6)
d=(31+28+31+30+31+past_day);

else if(past_month==7)
d=(31+28+31+30+31+30+past_day);

else if(past_month==8)
d=(31+28+31+30+31+30+31+past_day);

else if(past_month==9)
d=(31+28+31+30+31+30+31+31+past_day);
else if(past_month==10)
d=(31+28+31+30+31+30+31+31+30+past_day);
else if(past_month==11)
d=(31+28+31+30+31+30+31+31+30+31+past_day);

else
d=(31+28+31+30+31+30+31+31+30+31+30+past_day);

}
f=(past_year-1)/4;
birth_day=(past_year+d+f)%7;

switch(birth_day)
{
case 0: printf("\nFriday");break;
case 1: printf("\nSatarday");break;
case 2: printf("\nSunday");break;
case 3: printf("\nMonday");break;
case 4: printf("\nTuesday");break;
case 5: printf("\nWednessday");break;
case 6: printf("\nThursday");break;
default: printf("unknown");break;

}

}

return 0;
}```

The output of the above line of code looks like below:

[Note:] More interested things are waiting to publish..Stay connected to us..

——————-:Thank you:—————–