• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
July 18, 2024 |1.7K Views

Java Program to Test whether a Number is Palindrome or not

  Share  1 Like
Description
Discussion

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/