Sum Palindrome
Submissions: 8477   Accuracy:

21.44%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Given a number, reverse it and add it to itself unless it becomes a palindrome or number of iterations reach becom more than 5. If it becomes a palindrome then print that palindrome number, otherwise print -1.

Input: First line of the input contains an integer T denoting the number of test cases. Each test case has a single line containing a number.

Output: Corresponding to each test case, print the palindrome number or -1 as stated above.

Constraints:
1 <= T <= 200
1 <= N <= 1000

Example:
Input:
2
23
30
Output:
55
33

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

Contributor: Yash Kodesia
Author: Yash Kodesia 1


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.