Rohan and Madhav are playing a Mind game in which Rohan chooses a Number N (Integer)between 1 To 10 in his mind and Madhav has no idea about the chosen number.
Rohan is asked to perform the following operations on chosen number by Madhav.
Step 1:Double the chosen number.
Step 2:Add a number k(even number given as input) to the number obtained after Step1
Step 3:Divide the obtained number in Step 2 by 2.
Step 4:Now subtract the obtained number in Step 3 with the original chosen number N
Madhav's task is to find the answer obtained at the end of Step 4 ,i.e,at the end of all the mentioned operations performed on the number chosen by Rohan.
Help Madhav to find the answer.
The first line of input contains an integer denoting the number of test cases . Next line of input contains a positive even number K which is to be used in step 2.
For each test case , the output is in a new line containg an integer which is the required answer at the end of Step 4.
K is always even
Suppose rohan choses 3 then after
Step 4=8-3=5(required answer).
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.