Posted by Kousik
This is a program to calculate your
age./*AGE CALCULATE*/#include<stdio.h>int main(){int dd,dm,dy,cd,cm,cy,d,m,y;printf(“Enter your DATE OF BIRTH in dd mm yyyy format\n”);scanf(“%d %d %d”,&dd,&dm,&dy);printf(“Enter Current Date in dd mm yyyy format\n”);scanf(“%d %d %d”,&cd,&cm,&cy);y=cy-dy;if(dm>cm){y--;m=12-(dm-cm);if(dd>cd){m--;d=30-(dd-cd);}else{d=cd-dd;}}else{m=cm-dm;if(dd>cd){m--;d=30-(dd-cd);}else{d=cd-dd;}printf(“You AGE is \n”);printf(“%d days %d months %d years\n”,d,m,y);}
0 comments:
Post a Comment