Answer:
// here is code in c++.
// include headers
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
long long int inp_sec,days,hours,minutes,sec;
long long int s;
cout<<"please enter the seconds:";
// read the input seconds
cin>>inp_sec;
// make copy of input second
s=inp_sec;
// compute days,86400 seconds in a day
days=inp_sec/86400;
// update the seconds after counting days
inp_sec=inp_sec%86400;
// compute hours, 3600 seconds in an hour
hours=inp_sec/3600;
// update the seconds after counting hours
inp_sec=inp_sec%3600;
//compute minutes, 60 seconds in a minute
minutes=inp_sec/60;
// compute remaining seconds
sec=inp_sec%60;
// print the output
cout<<s<<" seconds is equal to "<<days<<" days "<<hours<<" hours "<<minutes<<" minutes "<<sec<<" seconds "<<endl;
return 0;
}
Step-by-step explanation:
Declare variables "inp_sec","days","hours","minutes" and "sec" of long long int type. read the seconds from user and assign it to variable "inp_sec".Make a copy of input seconds.Then compute the days by dividing inp_sec with 86400 and update the inp_sec. then find hours by dividing inp_sec with 3600 and update the inp_sec.Similarly find the minutes and remaining seconds.After this print the output.
Output:
please enter the seconds:83647362
83647362 seconds is equal to 968 days 3 hours 22 minutes 42 seconds