#include <stdio.h> #include <stdlib.h> int main(){ int bd, bm, by, cd, cm, cy, ad, am, ay; printf("Please give me your date of birth \n"); printf("day \t"); scanf("%d", &bd); printf("month \t"); scanf("%d", &bm); printf("year \t"); scanf("%d", &by); printf("Your date of birth is: %d / %d / %d\n\n", bd, bm, by); printf("Now give me to which date you want to calculate.\n"); printf("day \t"); scanf("%d", &cd); printf("month: \t"); scanf("%d", &cm); printf("year:\t"); scanf("%d", &cy); printf("Your age is being calculated : %d / %d / %d to %d / %d / %d \n\n", bd, bm, by, cd, cm, cy); // Calculation of age. if ( bd > cd){ cd = cd + 30; bm = bm+1; } ad = cd - bd; if ( bm > cm){ cm = cm + 12; by = by+1; } am = cm - bm; ay = cy - by; printf("Your age is : %d year %d month %d day", ay, am, ad); return 0; }