The dice problem | Java 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
import java . io . * ; class GFG { static void oppositeFaceOfDice ( int N ) { int ans = 7 - N ; System . out . println ( ans ) ; } public static void main ( String [ ] args ) { int N = 2 ; oppositeFaceOfDice ( N ) ; } }