CHALLENGE- Find ANGLE between the hands of a CLOCK | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

CHALLENGE- Find ANGLE between the hands of a CLOCK

You just need to make a program that inputs a time and outputs the angle made by the hands of the clock at that time. eg- INPUT - 3:00 OUTPUT - 90

3rd Oct 2017, 6:52 PM
Saurav Priyadarshi
Saurav Priyadarshi - avatar
64 Answers
5th Oct 2017, 9:29 AM
David Akhihiero
David Akhihiero - avatar
+ 9
Thanks for the challenge. Here's my try : https://code.sololearn.com/W35V56N2KXcZ/?ref=app
5th Oct 2017, 5:40 PM
LukArToDo
LukArToDo - avatar
3rd Oct 2017, 8:15 PM
m abrate
m abrate - avatar
+ 5
@Saurav Thanks... ☺️
5th Oct 2017, 7:21 PM
LukArToDo
LukArToDo - avatar
4th Oct 2017, 3:16 AM
Kartikey Sahu
Kartikey Sahu - avatar
+ 4
@Lukartodo Great program. That's a perfect one in #WEB catagory.
5th Oct 2017, 7:16 PM
Saurav Priyadarshi
Saurav Priyadarshi - avatar
+ 4
@Saurav I have rectified d reflex angle issue
5th Oct 2017, 7:39 PM
David Akhihiero
David Akhihiero - avatar
+ 4
Improved version of my code based on the comments of @Saurav and inspired by the exception handling of @Yerucham https://code.sololearn.com/cDgqbsPX9Wk8/?ref=app
5th Oct 2017, 8:06 PM
Stoyan Todorov
Stoyan Todorov - avatar
+ 4
I have fixed that, now it calculates to produce only non-reflex angles
5th Oct 2017, 8:17 PM
Meyoron Aghogho
Meyoron Aghogho - avatar
+ 4
Thank you guys for participating in the conversation. You all have come up with great programs. We have some perfectly great programs by- ## Lukartodo - Web ## Yerucham - Java ## Ankit - Python Now take a look at my C++ program. And please do comment about any MISTAKE or FLAW in my code. https://code.sololearn.com/cryL0B0K14zF/?ref=app
7th Oct 2017, 6:48 AM
Saurav Priyadarshi
Saurav Priyadarshi - avatar
+ 4
@saurav I just remodified my submission please check if there be any more errors now it calculates to float-point accuracy https://code.sololearn.com/cY8NnBtedbaM/?ref=app
7th Oct 2017, 10:56 AM
Meyoron Aghogho
Meyoron Aghogho - avatar
+ 3
https://code.sololearn.com/cHlefuiSHyyJ/?ref=app
3rd Oct 2017, 8:11 PM
Ankit Agrawal
Ankit Agrawal - avatar
+ 3
heres my one line code.. with FLOATING POINT ACCURACY https://code.sololearn.com/cjKsL1AJYGDr/?ref=app
4th Oct 2017, 4:37 PM
sayan chandra
sayan chandra - avatar
+ 3
@Sayan @Kartikey You both have made unexpectedly small programs. They are just 1 liner. Guys, do take care about the inputs you take. The programs even accept inputs that are not valid.
4th Oct 2017, 7:35 PM
Saurav Priyadarshi
Saurav Priyadarshi - avatar
+ 3
@Kartikey You shouldn't declare 12:4 as invalid time. That's unfair in its part.
4th Oct 2017, 8:10 PM
Saurav Priyadarshi
Saurav Priyadarshi - avatar
+ 3
marking thread
5th Oct 2017, 8:48 AM
David Akhihiero
David Akhihiero - avatar
5th Oct 2017, 12:37 PM
Stoyan Todorov
Stoyan Todorov - avatar
+ 3
@Stoyan Try to avoid reflex angles bro. Just add a line more to your program for converting reflex angles. And do look for other errors. You may get hints from the discussion.
5th Oct 2017, 7:07 PM
Saurav Priyadarshi
Saurav Priyadarshi - avatar
+ 3
@Saurav point taken m8. I didn't know that they were an issue since a clock is 360 degrees
5th Oct 2017, 7:11 PM
Stoyan Todorov
Stoyan Todorov - avatar
+ 3
@Stoyan I welcome you in the race of making a perfectly flawless program. All the best.
5th Oct 2017, 7:14 PM
Saurav Priyadarshi
Saurav Priyadarshi - avatar