Position of a person diametrically opposite on a circle | Function to return the required position ; Driver code
function getPosition ( n , m ) { if ( m > ( n / 2 ) ) return ( m - parseInt ( n / 2 ) ) ; return ( m + parseInt ( n / 2 ) ) ; } var n = 8 , m = 5 ; document . write ( getPosition ( n , m ) ) ;