switch hours and minutes
I am trying to calculate the number of times that hh:mm hours and minutes in a 24 hour period can be interchanged and still be a valid time.
example 5:10 can be switched to 10:5
22:40 can not be switched 40:20
I am clueless on how to tackle this problem
Why is this a C problem ?????????
Anyway a hint is
mm has to be less than or equal to the maximum value hh can take , which is ......
so what you're saying is that you need an allgorithm?
This is sinple, all hour values can be valid minute values, but only the first 12 (or 24, depending on how you keep time) minute values can be hour values, so check to see if the minutes <= 12 or 24, and if they are, the answer is possible to interchange them. Now you can write your code.