#include <bits/stdc++.h>
using namespace std;
//Conversion of second into days
void DayAndHourCalculations(int n)
{
int day = n / (86400);
n = n % (86400);
int hour = n / 3600;
n %= 3600;
int minutes = n / 60 ;
n %= 60;
int seconds = n;
cout << day << " " << "days " << hour
<< " " << "hours " << minutes << " "
<< "minutes " << seconds << " "
<< "seconds " << endl;
}
// Driver code
int main()
{
// n is the number of seconds
int n = 18000000;
DayAndHourCalculations(n);
return 0;
}
Comments
Leave a comment