Find the player who will win by choosing a number in range [ 1 , K ] with sum total N | Java program for the above approach ; Function to predict the winner ; Driver Code ; Given Input ; Function call
import java . io . * ; class GFG { static void predictTheWinner ( int K , int N ) { if ( N % ( K + 1 ) == 0 ) System . out . println ( " Bob " ) ; else System . out . println ( " Alice " ) ; } public static void main ( String [ ] args ) { int K = 7 , N = 50 ; predictTheWinner ( K , N ) ; } }