BETA

Difficulty Level: Easy

Submissions: 2910 Accuracy:

50.86%

Print Pattern
       

Print a sequence of numbers starting with N, without using loop, in which  A[i+1] = A[i] - 5,  if  A[i]>0, else A[i+1]=A[i] + 5  repeat it until A[i]=N.

Input:
First line contains number of test cases T. Then following T lines contains an integer N.


Output:
Single line with pattern .


Constraints:
0< N < 10000

Example:
Input:

2
16

10

Output:
16 11 6 1 -4 1 6 11 16

10 5 0 5 10

Explanation:
We basically first reduce 5 one by one until we reach a negative or 0. After we reach 0 or negative, we one by one add 5 until we reach N.

** For More Input/Output Examples Use 'Expected Output' option **

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.