What are prime numbers, amstrong, Palendrome and neon operators in JAVA?
Share
What are prime numbers, amstrong, Palendrome and neon operators in JAVA?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Verified answer
Armstrong Number
A number is called an Armstrong number if the sum of its digits to the power of the number of digits is the number itself. For example,
we have a number, 1634. To determine whether 1634 is an Armstrong, we need to check:
Does 1^4 + 6^4 + 3^4 + 4^4 equal 1634 ?
Yes! So 1634 is Armstrong Number.
Similarly, 153 is Armstrong because 1^3 + 5^3 + 3^3 equals to 153.
Palindrome Number
A number is said to be a Palindrome if the reverse of its digit is number itself. For eg. 121, 959, 1441, etc.
Prime Number
A natural number greater than 1 is called a prime number, if it has no divisor other than 1 and itself. For eg. 2, 3, 5, 7, ...
The Java program written below has a class named VariousNumbers which contain three public static functions excluding main, listed below:
1. Public static boolean Armstrong(int) // Return true, if an integer is found to be an Armstrong, else return false.
2. Public static boolean Palindrome(int) // Return true, if an integer is found to be a Palindrome, else return false.
3. Public static boolean Prime(int) // Return true, if an integer is found to be a Prime, else return false.