Advertisement
noshin98

uva11219

Jun 26th, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int d1,d2,m1,m2,y1,y2,age,t,i;
  5. while(scanf("%d",&t)==1)
  6. {
  7. for(i=1;i<=t;i++)
  8. {scanf("%d/%d/%d",&d2,&m2,&y2);
  9. scanf("%d/%d/%d",&d1,&m1,&y1);
  10. if(d1>d2)
  11.  {d2=d2+30;
  12.  m1=m1+1;}
  13. if(m1>m2)
  14.  {m2=m2+12;
  15.  y1=y1+1;}
  16. age=y2-y1;
  17. if(age<0)
  18. printf("Case #%d: Invalid birth date\n",i);
  19. else if(age>130)
  20. printf("Case #%d: Check birth date\n",i);
  21. else
  22. printf("Case #%d: %d\n",i,age);
  23. }
  24. }
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement