Chemistry, asked by musaashraf98, 3 months ago

(ii) A program is created to convert hours and minutes into a total number of minutes.
The teacher wants to create a sub program to perform the calculation.
The program has been started but is not complete.
Complete the design for the program.

Answers

Answered by bhaktihbalwadkar
0

Program for converting hours into minutes and seconds

Given an integer n which is the number of hours, the task is to convert it into minutes and seconds.

Examples:

Input: 5

Output: Minutes = 300, Seconds = 18000

Input: 2

Output: Minutes = 120, Seconds = 72

h hours = h * 60 minutes as 1 hour = 60 minutes.

Similarly h hours = h * 3600 seconds.

Note: To convert m minutes back into hours, do n / 60 and for s seconds s / 3600.

long long int minutes, seconds;

minutes = n * 60;

seconds = n * 3600;

cout << "Minutes = " << minutes

<< ", Seconds = " << seconds << endl;

}

// Driver code

int main()

{

int n = 5;

ConvertHours(n);

return 0;

}

Output:

Minutes = 300, Seconds = 18000

Time Complexity : O(1)

Recommended Posts:

Converting seconds into days, hours, minutes and seconds

Python program to convert seconds into hours, minutes and seconds

Program to find the time after K minutes from given time

How to create and deploy your portfolio in under 10 minutes

Total money to be paid after traveling the given number of hours

Similar questions