URI Online Judge Solution 1020 | Age In Days - URI 1020 Solution in C,C++,Python

URI Online Judge Solution  1020 | Age In Days - URI 1020 Solution in C,C++,Python

Read an integer value corresponding to a person's age (in days) and print it in years, months and days, followed by its respective message “ano(s)”, “mes(es)”, “dia(s)”.

Note: only to facilitate the calculation, consider the whole year with 365 days and 30 days every month. In the cases of test there will never be a situation that allows 12 months and some days, like 360, 363 or 364. This is just an exercise for the purpose of testing simple mathematical reasoning.

Input

The input file contains 1 integer value.

Output

Print the output, like the following example.

URI Online Judge Solution  1020 | Age In Days - URI 1020 Solution in C,C++,Python:


  URI Problem 1020 Solution in C :   

  URI Online Judge 1020 Solve  in C :                                                                             
#include<stdio.h>

int main()
{
 int years, months, days;
   
 scanf("%d", &days);
   
 years = days / 365;
   
 months = days % 365 / 30;
   
 days = days % 365 % 30;
   
 printf("%d ano(s)\n%d mes(es)\n%d dia(s)\n", years, months, days);
   
 return 0;
   
}

0 Response to URI Online Judge Solution 1020 | Age In Days - URI 1020 Solution in C,C++,Python

Post a Comment