Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using static System.Console;
- class Program
- {
- public static void Main(string[] args)
- {
- Console.WriteLine(calcAngle(6,00));
- }
- static int calcAngle(double h,double m)
- {
- if(h<0 || m<0 || h>12 || m>60)
- {
- Console.Write("Wrong");
- }
- if(h==12)
- {
- h = 0;
- }
- if(m==60)
- {
- m = 0;
- }
- int hourangle = (int)(0.5 * (h * 60 + m));
- int minuteangle = (int)(6 * m);
- int angle = Math.Abs(hourangle - minuteangle);
- angle = Math.Min(360 - angle, angle);
- return angle;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement