Karen has a discrete analog clock in the shape of a circle. Two hands rotate around the center of the circle, indicating hours and minutes. The clock has 60 marks placed around its perimeter, with the distance between consecutive marks being constant.
The minute hand moves from its current mark to the next exactly once every minute. The hour hand moves from its current mark to the next exactly once every 12 minutes, so it advances five marks each hour. We consider that both hands move discretely and instantly, which means they are always positioned exactly over one of the marks and never in between marks.
At midnight both hands reach simultaneously the top mark, which indicates Zero hours Zero minutes. After exactly 12 hours or 720 minutes, both hands reach the same position again, and this process is repeated over and over again. Note that when the minute hand moves, the hour hand may not move; however, when the hour hand moves, the minute hand also moves.
Karen likes geometry, and she likes to measure the minimum angle between the two hands of the clock at different times of the day. She has been writing some measures down, she noticed that some angles were repeated while some others never appeared. For instance, Karen noticed that both at three o'clock and at nine o'clock the minimum angle between the two ands is 90 degrees, while an angle of 65 degrees not appear in the list.
Karen decided to verify, for any integer number between 0 and 180, if there exists at least one time of the day such that the minimum angle between the two hands of the clock is exactly A degrees. In this lab you will code a program to help Karen to answer this question and display which hour meet the angle.
NOTE: Your program needs to perform operation(s) and use control statements to solve the problem. Solutions that imply to create a switch-case or if-else for all 181 (or 91) possible values (Hard Coding) automatically will be scored with 0.
Input:
The program gets as input an integer value A s.t. (0<= A <= 180), which represents the angle to be verified. Validate that this input is within the valid range.
Output:
If there exist at least one time of the day such that the minimum angle between the two hands of the clock is exactly A degrees, then display how many hours met the specified angle and those hours in ascending order (24-hour military time clock). Otherwise display "There is no hour where the hands are A degrees apart".

Could you code this one to C please?



Answer :

Other Questions