Check for three consecutive numbers
Submissions: 897   Accuracy:

49.98%

  Difficulty: Basic   Marks: 1

Given an integer n, the task is to find whether n can be written as sum of three consecutive integer.

Input:

The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows, a single line of the input containing a positive integer N.


Output:

For each testcase, if it is possible to write as a sum of three consecutive integers  then print three consecutive integer, else print “-1”.
Constraints:

1<=T<=100

1<=N<=10000
Example:

Input:

2

6

7

Output:

1 2 3

-1

Explanation:
Testcase 1: N = 6 can be written as 1+2+3.

Testcase 2: N = 7 can be written as a sum of three consecutives.

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

Contributor: Sahil Chhabra
Author: Sahil_Chhabra


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.



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


to report an issue on this page.