Anik_Akash

11219 How old are you?

May 16th, 2020
137
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     int i, t, d1, d2, m1, m2, y1, y2, fy;
  6.     scanf("%d", &t);
  7.     for(i=1; i<=t; i++){
  8.         scanf("%d/%d/%d", &d1, &m1, &y1);
  9.         scanf("%d/%d/%d", &d2, &m2, &y2);
  10.  
  11.         fy = y1-y2;
  12.         if(y1==y2 && m1<m2){
  13.             printf("Case #%d: Invalid birth date\n",i);
  14.         }
  15.         else if(fy>130){
  16.             printf("Case #%d: Check birth date\n",i);
  17.         }
  18.         else if(y1>y2 && m1>m2){
  19.             printf("Case #%d: %d\n", i, fy);
  20.         }
  21.         else if(y1>y2 && m1==m2){
  22.             printf("Case #%d: 0\n", i);
  23.         }
  24.     }
  25.     return 0;
  26. }
RAW Paste Data