Java Program to Test whether a Number is Palindrome or not
source link: https://www.geeksforgeeks.org/videos/java-program-to-test-whether-a-number-is-palindrome-or-not/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Java Program to Test whether a Number is Palindrome or not
- 330 Views
- 07/06/2022
In this video, we will see a JAVA program to check whether a number is a palindrome or not.
What is a palindrome number? If the reverse of the number is the same as the number then it is said to be a palindrome number.
To check whether a number is palindrome or not we use three different methods:
1) By creating a new number 2) Half and reverse method 3) Using string
For examples: Input: S = “191” Output: Yes
Explanation: The reverse of the given number is equal to the (191) which is equal to the given number. Therefore, the given number is a palindrome.
For example: Input: S = “192” Output: No
Explanation: The reverse of the given number is equal to the (291) which is not equal to the given number. Therefore, the given number is not a palindrome.
Check if a number is Palindrome or not: https://www.geeksforgeeks.org/check-if-a-number-is-palindrome/ https://www.geeksforgeeks.org/program-to-check-the-number-is-palindrome-or-not/
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK