Given an integer N the task is to create a string out of it by repeating the number such that the length of the resultant string is equal to the sum of the digits in the original number.
For eg: If the number is 61 and the sum of the digits is 6 + 1 = 7 so the string generated after repeating 61 will be of 7 length i.e. 6161616.
Input: N = 10101
Length of the string is given by sum of the digits i.e. 1 + 0 + 1 + 0 + 1 = 3.
So the resultant string is “101” which is a palindrome.
Input: N = 123
Length of the string will be 1 + 2 3 = 6.
So the resultant string is “123123” which is not a palindrome.
- Find the sum of the digits of N and repeat the number till the length of the string becomes equal to this sum.
- Now check if the resultant string is a palindrome or not.
- If it is a palindrome then print Yes.
- Else print No.
Below is the implementation of the above approach:
- Check if a number is Palindrome
- Check if a number is Palindrome in PL/SQL
- Check if number is palindrome or not in Octal
- Program to check the number is Palindrome or not
- Bash program to check if the Number is a Palindrome
- Recursive program to check if number is palindrome or not
- To check a number is palindrome or not without using any extra space
- Check if a number with even number of digits is palindrome or not
- Check if actual binary representation of a number is palindrome
- Largest even number possible by using one swap operation in given number
- C Program to Check if a Given String is Palindrome
- Check if a given string is a rotation of a palindrome
- Check if any anagram of a string is palindrome or not
- Check if it is possible to create a palindrome string from given N
- Check if a string is palindrome in C using pointers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.