Question: I've bolded the problem but I am trying to fix my code for errors. If you can submit a corrected version of my code that
I've bolded the problem but I am trying to fix my code for errors. If you can submit a corrected version of my code that will be great
C++ Code:
// Author : (Anonymous)
/* Write a program that convert 1,000,000 seconds to years, months, weeks and days. */
#include
#include
using namespace std;
int main()
{
double seconds, years, months, weeks, days;
cout << "Input seconds: " << endl;
cin >> seconds;
//calculate formula for seconds in years, months, weeks, and days
days = seconds / 86400;
weeks = seconds / 604800;
months = seconds / 2592000;
years = seconds / 31557600;
cout << "1,000,000 seconds converts to " << years << " years," << months << " months," << weeks
<< " weeks," << days << " days." << setprecision(10);
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
