Kevin And The Number On A Dice

Posted: 11 Mar, 2021
Difficulty: Easy

PROBLEM STATEMENT

Try Problem

Kevin is playing Ludo. Whenever he throws the dice he gets a number on the front face of the dice but he is interested in knowing the number written on the opposite side of the dice.

You have to help Kevin in finding the number written on the opposite side of the dice.

Note:
Dice is fair. Formerly dice has 6 faces and each face has a number in the range of 1 to 6.
Input Format:
The first line contains a single integer ‘T’ representing the number of test cases. 

The first line of each test case will contain a single integer ‘N’ which denotes the number written on the front face of the dice.
Output Format:
For each test case, print the number written on the opposite side of the dice.

Output for every test case will be printed in a separate line.
Note:
You don’t need to print anything; It has already been taken care of.
Constraints:
1 <= T <= 10^7
1 <= N <= 6

Where ‘T’ is the number of test cases.

Where 'N' is the number written on the front face of the dice.

Time limit: 1 sec
Approach 1

The basic idea is to analyze the sum of numbers written on the opposite faces of a dice i.e 7. Now, we have to just return the number that we get after subtracting ‘N’ from 7.

 

The steps are as follows:

 

  1. Return 7 - ‘N’.
Try Problem