Code:
#include <iostream>
using namespace std;
int main(){
int input, dd, mm1, mm, yy;
cout << "Enter the number of days: ";
cin >> input;
yy = input/365;
mm1 = input%365;
mm = mm1/30;
dd = mm1%30;
cout << input <<" days = "<< yy << " year(s) " << mm << " month(s) " << dd << " day(s)";
}
#include <iostream>
using namespace std;
int main(){
int input, dd, mm1, mm, yy;
cout << "Enter the number of days: ";
cin >> input;
yy = input/365;
mm1 = input%365;
mm = mm1/30;
dd = mm1%30;
cout << input <<" days = "<< yy << " year(s) " << mm << " month(s) " << dd << " day(s)";
}
Output:
Enter the number of days: 500
500 days = 1 year(s) 4 month(s) 15 day(s)
Process returned 0 (0x0) execution time : 5.008 s
Press any key to continue.