0
write a program to convert time given in minutes into hours and minutes left out....?
8 Answers
+ 3
you forgot : "please" !
+ 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;
}
+ 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;
}
+ 1
ok.pls.
+ 1
abeee ans. aata bhi hai
+ 1
sorry Abhi, main newbie hoon answers karnay may waqt lagega.
+ 1
thankx
0
hahaha