Header Ads

Header ADS

Solution of URI 1020::Age in Days

Before seeing the solution make sure that you have tried enough. Don’t copy the whole code, just find out the logic. If you feel any problemyou will inform me by comment.





#include<stdio.h>
int main ()
{

    int TD,y,m,d;


    scanf("%d",&TD);

    y=TD/365;
    m= ((TD- (y*365))/30);
    d=(TD- ((365*y)+(m*30)));

    printf("%d ano(s)\n",y);
    printf("%d mes(es)\n",m);
    printf("%d dia(s)\n",d);

    return 0;
}

No comments

Theme images by konradlew. Powered by Blogger.