using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Questions
{
class Program
{
static void Main(string[] args)
{
int hours, int mins
/* input :- 9 30 output :- The angle between hour hand and minute
hand is 105 degrees
* input :- 13 30 output :- The angle between hour hand and minute
hand is 135 degrees* */
double hourDegrees = (hours * 30) + (mins * 30.0 / 60);
double minuteDegrees = mins * 6;
double diff = Math.Abs(hourDegrees - minuteDegrees);
if (diff > 180)
{
diff = 360 - diff;
}
Console.WriteLine("The angle between hour hand and minute hand is {0}
degrees", diff);
}
}
}
top of page
To see this working, head to your live site.
How to find the angle between hour and minute hands of a clock at any given time-C# Programming Help
How to find the angle between hour and minute hands of a clock at any given time-C# Programming Help
0 comments
Like
Comments
bottom of page