Friday, October 26, 2018

Uri 1020 solution in C | Age in Days

/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/

#include<stdio.h>
main()
{
    int n,y,m,d,n1,n2;
    scanf("%d",&n);
    y=n/365;
    n1=n%365;
    m=n1/30;
    n2=n1%30;
    d=n2;
    printf("%d ano(s)\n%d mes(es)\n%d dia(s)\n",y,m,d);
    return 0;
}

 //Happy_Coding

No comments:

Post a Comment