0

write a program to convert time given in minutes into hours and minutes left out....?

15th Jul 2016, 3:58 PM
Abhishek Nyamati
Abhishek Nyamati - avatar
8 Réponses
+ 3
you forgot : "please" !
15th Jul 2016, 4:11 PM
Dorian
+ 2
assuming you are looking for a program that prints out hours and minutes this will work: #include <iostream> using namespace std; int main() { string ltTen="0"; int time; cin>>time ; int hour=0; while (time >= 60) { time-=60; hour++;} cout << hour <<":"; if(time < 10) cout <<ltTen<<time; else cout <<time; return 0; } however if you don't want minutes printed just hours this works as well: #include <iostream> using namespace std; int main() { int time; cin>>time ; int hour=0; while (time >= 60) { time-=60; hour++; } cout << hour; return 0; }
15th Jul 2016, 4:54 PM
destro
+ 2
Assuming you need this? #include <iostream> using namespace std; int main () { int M; cin >> M; cout << M/60 << endl << M%60 << endl; //remember M/60 is hour M%60 is minute return 0; }
15th Jul 2016, 11:30 PM
_Geometry dash_ _Roh_ (AKA NovaRate0315)
_Geometry dash_ _Roh_ (AKA NovaRate0315) - avatar
+ 1
ok.pls.
15th Jul 2016, 4:14 PM
Abhishek Nyamati
Abhishek Nyamati - avatar
+ 1
abeee ans. aata bhi hai
15th Jul 2016, 4:23 PM
Abhishek Nyamati
Abhishek Nyamati - avatar
+ 1
sorry Abhi, main newbie hoon answers karnay may waqt lagega.
15th Jul 2016, 4:27 PM
Abdullah
Abdullah - avatar
+ 1
thankx
15th Jul 2016, 4:59 PM
Abhishek Nyamati
Abhishek Nyamati - avatar
0
hahaha
15th Jul 2016, 4:18 PM
Abdullah
Abdullah - avatar