URI - BEECROWD - BEE Online Judge Solution 1020 | Age In Days - URI - BEECROWD - BEE 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
URI Online Judge Solution 1020 | Age In Days - URI 1020 Solution in C,C++,Python:
#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 - BEECROWD - BEE 1020 | Age In Days Solution in C,C++,Python
Post a Comment