The dice problem | C ++ program for the above approach ; Function to find number written on the opposite face of the dice ; Stores number on opposite face of dice ; Print the answer ; Driver Code ; Given value of N ; Function call to find number written on the opposite face of the dice
#include <bits/stdc++.h> NEW_LINE using namespace std ; int oppositeFaceOfDice ( int N ) { int ans = 7 - N ; cout << ans ; } int main ( ) { int N = 2 ; oppositeFaceOfDice ( N ) ; return 0 ; }