Computer Science, asked by swaddmasteeh1837, 10 months ago

Write a program that accepts a time as an hour and minute. Add 15 minutes to the time, and output the result.

Answers

Answered by eementuvsk
0

Answer:

Attached below...

Explanation:

Run the below program in any text editor and compile it with c compiler.

Finally, you get the output.

Attachments:
Answered by suskumari135
0

A program that accepts a time as an hour and minute. Add 15 minutes to the time, and output the result.

Explanation:

C++ program that accepts a time as an hour and minute. Add 15 minutes to the time, and output the result.

#include<iostream>

using namespace std;

int main()

{

int hr, min;

cout<<"Input Hour value: \n";

cin>>hr;

cout<<"Input minute value: \n";

cin>>min;

if(min+15>=60)

{

hr = ++hr;

min = (min+15)-60;

}

else

{

min = min +15;

}

cout<<"Time in Hour:"<<hr<<" Minutes: "<<min;

return 0;

}

Output

Input Hour value: 9                                                                              Input minute value:  45                                                                       Time in Hour:10 Minutes: 0

Similar questions