Find the player who will win the Coin game | C ++ program to find the player who wins the game ; Function to check the wining player ; As discussed in the above approach ; Driver function
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findWinner ( int n ) { if ( ( n - 1 ) % 6 == 0 ) { cout << " Second ▁ Player ▁ wins ▁ the ▁ game " ; } else { cout << " First ▁ Player ▁ wins ▁ the ▁ game " ; } } int main ( ) { int n = 7 ; findWinner ( n ) ; }