Count of obtuse angles in a circle with ' k ' equidistant points between 2 given points | Java program to count number of obtuse angles for given two points ; There are two arcs connecting a and b . Let us count points on both arcs . ; Both arcs have same number of points ; Points on smaller arc is answer ; Driver Program to test above function
class GFG { static int countObtuseAngles ( int a , int b , int k ) { int c1 = ( b - a ) - 1 ; int c2 = ( k - b ) + ( a - 1 ) ; if ( c1 == c2 ) return 0 ; return min ( c1 , c2 ) ; } public static void main ( String arg [ ] ) { int k = 6 , a = 1 , b = 3 ; System . out . print ( countObtuseAngles ( a , b , k ) ) ; } }