Interview Q: find angle between hour and minute hands in an analog clock

Posted by polygenelubricants on Stack Overflow See other posts from Stack Overflow or by polygenelubricants
Published on 2010-05-01T05:07:01Z Indexed on 2010/05/01 5:17 UTC
Read the original article Hit count: 281

I was given this interview question recently:

An analog clock shows that the current time is HH:MM. Compute in degree, the smaller angle between the hour and minute hands. Be as precise as you can.

I'm wondering what's the simplest, most readable, most precise algorithm is. Solution in any language is welcome (but do explain it a bit if you think it's necessary).

© Stack Overflow or respective owner

Related posts about interview-questions

Related posts about math