Age in Days
Adapted by Neilor Tonin, URI Brazil | Timelimit: 1
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.
Input Sample | Output Sample |
400 | 1 ano(s) 1 mes(es) 5 dia(s) |
800 | 2 ano(s) 2 mes(es) 10 dia(s) |
30 | 0 ano(s) 1 mes(es) 0 dia(s) |
#include<stdio.h>
int main()
{
int n,y,m ,m1,d;
scanf("%d",&n);
y=n/365;
m=n%365;
m1=m/30;
d=m%30;
printf("%d ano(s)\n",y);
printf("%d mes(es)\n",m1);
printf("%d dia(s)\n",d);
return 0;
}
- How to Use URI Online Judge to Improve Your Coding Skills and Boost Your Career
- BEST FREE GIFT CARD GENERATOR in 2022
- উইন্ডোজ 11 এসে গেল, নজরকাড়া লুক, তাক লাগানো ফিচার্স!
- URI 2694 Solved by C programming
- URI Online Solve | 1957 Converting to Hexadecimal- Solution
- Android custom toolbar Android Studio | Android Tutorial
- URI Online Judge | 1040 Solution | Average 3
- URI Online Judge | 1038 Solution |Snack
- URI Online Judge | 1037 Solution | Interval
- URI Online Judge | 1036 Solution | Bhaskara’s Formula
- URI Online Judge Solution| 1035 Selection Test 1
- URI Online Judge Solution| 1021 Banknotes and Coins
- URI Online Judge Solution| 1020 Age in Days
- URI Online Judge Solution| 1019 Time Conversion
- URI Online Judge Solution| 1018 Banknotes