#include <stdio.h>
main ()
{int y,m,d,yN,mN,dN,Y,M,D;
printf("Enter y,m,d:");
scanf("%d %d %d",&y,&m,&d);
printf("Enter yN,mN,dN:");
scanf("%d %d %d",&yN,&mN,&dN);
if (dN<d){ D=dN+30-d;
if (mN<m)
{M=mN+12-m-1;
Y=yN-y-1;
}
else
{M=mN-m;
Y=yN-y;
}
}
else{ D=dN-d;
if (mN<m)
{M=mN+12-m;
Y=yN-y-1;
}
else
{M=mN-m;
Y=yN-y;
}
}
printf("age=%d.%d.%d\n",Y,M,D);
}
翻阅古今
相关分类