Answer to Question #264903 in C++ for Rille

Question #264903

20. Make a program that will input seconds, convert it into minutes and hour. Display the equivalent minutes and hour/s . Your program will be terminated if you input zero in the hour.


Ex. Enter seconds: 120


Minutes = 2 (120 seconds/60)


Equivalent Hour is = 0.033 (120 seconds/ 3,600 seconds in 1 hour)




1
Expert's answer
2021-11-16T05:21:53-0500

Source code

#include <iostream>




using namespace std;




int main()
{
    while(true){
        int seconds;
        cout<<"\nEnter seconds: ";
        cin>>seconds;
        
        double minutes=seconds/60.0;
        double hours=seconds/3600.0;
        
        if (hours==0){
            break;
        }
        cout<<"\nMinutes = "<<minutes<<"("<<seconds<<" seconds/60)";
        cout<<"\nEquivalent Hour is = "<<hours<<"("<<seconds<<"  seconds/ 3,600 seconds in 1 hour)";
        


    }




    return 0;
}


Output





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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS