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
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
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
Chemistry,
5 months ago
Math,
5 months ago
India Languages,
10 months ago
India Languages,
10 months ago