# Answer to Question #29514 in C++ for saly

Question #29514
Write a program that ask the user to enter a number of seconds 15 Times.

There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds.
There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600, the program should display the number of hours in that many seconds.
There are 86,400 seconds in a day. if the number of seconds entered by the user is greater than or equal to 86,400, the program should display the number of days in that many seconds.

Instructions:
60*60*24 == Day
3989
7422 - 3600 1 day== 3822 -3600 2 day = 222 3.7
86401 = 1 Day and 1 Second

2700 = 45 minutes
2520 = 42 Minutes

1989/60 = 33.5 Minutes

if(number &gt; 60 && number &lt; 3600)
number / 60 == Minutes
else if(number &gt; 3600 && number &lt; 86400)
3989 - 3600 = 389 == 1 Day and 6.44 minutes
7422 // 2 Days and 3.7 Minutes
1
2013-05-09T08:24:11-0400
//There are 60 seconds in a minute. If the number of seconds entered by the user is greater than
// or equal to 60, the program should display the number of minutes in that many seconds.
//There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than
//or equal to 3,600, the program should display the number of hours in that many seconds.
//There are 86,400 seconds in a day. if the number of seconds entered by the user is greater than
//or equal to 86,400, the program should display the number of days in that many seconds.

#include <iostream>
#include <string>
#include <list>
using namespace std;

int main(){

long time=0;
int day=0;
int hour=0;
int min=0;

cout<<"Enter time in sec:";
cin>>time;
if(time / 86400 !=0)& { day = time / 86400;
time = time % 86400;
}
if (time / 3600 != 0 ) {hour = time / 3600;
time =time % 3600;
}
if (time / 60 != 0 ) {min = time / 60;
time =time % 60;
}

cout<<"It is "<<day<<" days "<<hour<<" hours "<<min<<" minutes\n";

system("PAUSE");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!