64 542
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #9710 in C++ for jacob

Question #9710
flowchart of a program that ask the user to enter a number of seconds. There are 60 seconds in a min. 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 entered by the user is greater than or equal to 86,400, the program should display that number of day in that many seconds.
Expert's answer

#include <iostream>

using namespace std;




int main(){

unsigned int sec;

cout<<"Enter a number of seconds: ";

cin>>sec;

if (sec < 60){

cout<<sec<<" seconds
";

}else if (sec < 3600){

cout<<sec / 60<<"minutes
";

}else if(sec < 86400){

cout<<sec / 3600<<"hours
";

} else{

cout<<sec / 86400<<"days
";

}

}

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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions