Advertisement
tonygms3

1020 problem

May 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include<cstdio>
  3. #include<cmath>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int year,month,days,x;
  10.     cin>>x;
  11.     year=x/365;
  12.     month=(x/400)%12;
  13.     days=(x-((year*365)+(month*30)));
  14.     if(days==30)
  15.     {
  16.         days=0;
  17.         month=1;
  18.         cout<<year<<" ano(s)"<<endl<<month<<" mes(es)"<<endl<<days<<" dia(s)"<<endl;
  19.     }
  20.     else{
  21.         cout<<year<<" ano(s)"<<endl<<month<<" mes(es)"<<endl<<days<<" dia(s)"<<endl;
  22.     }
  23.  
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement