Your program must keep on prompting the user if an incorrect time was given; see below for examples. The program then converts the time into the usual US format with hours from 1 to 12, the minutes and an AM or PM marker. This conversion works like follows: • 0 hours become 12 o’oclock AM, • 1 through 11 hours become 1 through 11 hours AM, • 12 hours become 12 o’clock PM, • 13 through 23 hours become 1 through 11 hours PM, with a subtraction of 12. The program then displays the time in the usual US format. Please use care when displaying the minutes, as an extra zero needs to be displayed for minutes 0 to 9. See the examples below for details. Examples of input and output: Please enter the hours on a 24 hour clock (0-23): 15 Please enter the minutes (0-59): 7 You entered 3:07PM Please enter the hours on a 24 hour clock (0-23): 27 Please enter the minutes (0-59): 17 Sorry, your input is incorrect. Write a program clock.c that asks the user to input a moment in time as an hour and a minute. The hours are given in a 24 hour (European/Military) format, with hours from 0 to 23. The minutes are given as usual, between 0 and 59.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
Your program must keep on prompting the user if an incorrect time was given; see below for examples. The program then converts the time into the usual US format with hours from 1 to 12, the minutes and an AM or PM marker. This conversion works like follows: • 0 hours become 12 o’oclock AM, • 1 through 11 hours become 1 through 11 hours AM, • 12 hours become 12 o’clock PM, • 13 through 23 hours become 1 through 11 hours PM, with a subtraction of 12. The program then displays the time in the usual US format. Please use care when displaying the minutes, as an extra zero needs to be displayed for minutes 0 to 9. See the examples below for details. Examples of input and output: Please enter the hours on a 24 hour clock (0-23): 15 Please enter the minutes (0-59): 7 You entered 3:07PM Please enter the hours on a 24 hour clock (0-23): 27 Please enter the minutes (0-59): 17 Sorry, your input is incorrect. Write a program clock.c that asks the user to input a moment in time as an hour and a minute. The hours are given in a 24 hour (European/Military) format, with hours from 0 to 23. The minutes are given as usual, between 0 and 59.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education