77 976
Assignments Done
Successfully Done
In August 2019

Answer to Question #23766 in C++ for marwan

Question #23766
write a program that prompts the user for an integer value for a length of a youtube clip in seconds then display the number of hours minutes seconds
for example your youtube clip is 7350 seconds length you would display
youtube clip 2 hours 2 minutes and 30 seconds
thank you
Expert's answer
#include <iostream>
#include <cmath>
using namespace std;

int main()
cout << "please enter time(sec)" << endl;
& int time;
& cin>>time;
& int h1,hour,m1,minute;
& h1 =time%3600;
& hour=(time-h1)/3600;

& m1 =h1%60;
& minute=(h1-m1)/60;

& cout<<"number hour= "<<hour<<endl;
cout<<"number minute= "<<minute<<endl;
cout<<"number sec= "<<m1<<endl;
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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions