Answer to Question #263003 in C++ for Rille

Question #263003

Make a program that will input hour, convert it into minutes and seconds. Display the minutes


and seconds respectively. Your program will be terminated if you input zero in the hour.


Ex. Hour = 2


Minutes = 120


Seconds = 7200

1
Expert's answer
2021-11-12T00:07:35-0500
#include <iostream>

using namespace std;

int hour;

int main()
{
  cout << "Hour: ";
  cin >> hour;
  if (hour > 0)
  {
    cout << "Minutes: " << hour * 60 << "\n";
    cout << "Seconds: " << hour * 3600 << "\n";
  }
  else
  {
    cout << "Terminated\n";
  }
}

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