... HAVE U TRIED .... AT LEAST 3 TIMES ... OK U CAN SEE THIS ...

Tuesday, December 24, 2013

UVA-11219 :: How old are you?

#include <stdio.h>
int main ()
{
    int t  ,cd ,cm , cy , bd, bm ,by ,x ,i  ;

    scanf ("%d",&t) ;
    for (i=1 ; i<=t ; i++)
    {

        scanf ("%d/%d/%d",&cd ,&cm ,&cy) ;
        scanf ("%d/%d/%d",&bd ,&bm ,&by) ;

        if (cd < bd)
        {
            cd = cd +30 ;
            cm-- ;
        }

        if (cm <bm)
        {
            cm = cm+ 12 ;
            cy-- ;
        }

        x = cy - by ;

        if (x < 0) printf ("Case #%d: Invalid birth date\n",i) ;
        else if (x > 130) printf ("Case #%d: Check birth date\n",i) ;
        else  printf ("Case #%d: %d\n",i ,x) ;

    }

    return 0 ;
}