Coder Social home page Coder Social logo

clockangle's Introduction

Clock Angle

Have you ever wondered what the angle between the hour hands on a clock is at two different times?
Me neither, but here it is anyway.

Simply provide two times in the format hh:mm:ss and the program will calculate the angle between the hour hands.
Or if you're feeling fancy, you can just give one time in the same format as above. This will tell the program that you want to know the angle between the minute and the hour hand.

Running

Compile with

gcc clockangle.c -o clockangle

To debug, use

gcc clockangle.c -o clockangle -DDEBUG

Hour Hands

To find the minimum angle between the hour hands on two superimposed clocks, run the program with:

./clockangle h1:m1:s1 h2:m2:s2

For example:

./clockangle 2:06:52 19:43:08

The program will return the minimum angle between the two hour hands.

Minute/Hour Hands

To find the minimum angle between the hour and minute hand on one clock, run the program with:

./clockangle h:m:s

For example:

./clockangle 06:46:45

clockangle's People

Contributors

jolonb avatar

Watchers

 avatar  avatar

clockangle's Issues

Make it work for a single clock

Rather than just calculating the angle between the hours hands of two clocks, this program could also have the option to have only one input argument and it will calculate the angle between the hour and minute hands

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.