Today's problem comes to us from /u/newbie12q. Thanks for the submission!
Create a function that takes in an hour and a minute input and finds the angle between the two hands. For example:
findAngle(12, 30) > 165
Today's problem comes to us from /u/newbie12q. Thanks for the submission!
Create a function that takes in an hour and a minute input and finds the angle between the two hands. For example:
findAngle(12, 30) > 165
Permalink: http://problemotd.com/problem/clock-angle/
Content curated by @MaxBurstein
Comments:
Anonymous - 10 years, 4 months ago
I think you should put the angle is in degrees
/u/newbie12q
reply permalink
Johnathan - 10 years, 4 months ago
It needs more error checking or explaining, but values like 5:15 or 05:15 both work and that's enough for me.
reply permalink
Anonymous - 10 years, 4 months ago
''' /** * ClockAngle.java * Calculates the angle between the hands of an * analogue clock given the value of the hour and * minute hands */
import java.util.Scanner;
public class ClockAngle{
} '''
reply permalink
jedrek - 10 years, 3 months ago
Am I out of it, but shouldn't the example be 180?
reply permalink
Johnathan - 10 years, 3 months ago
No, because the hour hand is only on the 12 at exactly 12:00. at 12:30 the hour hand is halfway between the 12 and the 1.
reply permalink
Anonymous - 10 years, 3 months ago
reply permalink