Professional Documents
Culture Documents
Program and Q - A
Program and Q - A
Programs
1. Write a Program in Java to input a number and check whether it is a Pronic Number or A
Pronic number is a number which is the product of two consecutive integers, that is, n (n
+ 1). The first few Pronic numbers are:
0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210,
2. A happy number is a number in which the eventual sum of the square of the digits of the
number is equal to 1.
3. Write a Java program to check if a number entered is a Neon Number or not, in JAVA. A
number is said to be a Neon Number if the sum of digits of the square of the number is
equal to the number itself.
4. A number is a Spy number, if sum and product of all digits are equal.
Example: Number 123 is a Spy number, sum of its digits is 6 (1+2+3 =6) and product of its
digits is 6 (1x2x3 = 6), sum and product are same, thus, 123 is a spy number.
Write a Java program to check whether a Given Number is spy no. Or not.
1
5. A number is called an automorphic number if and only if the square of the given number
ends with the same number itself. For example, 25, 76 are automorphic numbers
because their square is 625 and 5776, respectively and the last two digits of the square
represent the number itself.
6. A Dudeney number is a positive integer that is a perfect cube such that the sum of its
digits is equal to the cube root of the number. Write a program to input a number and
check and print whether it is a Dudeney number or not.
10. Write a program to input a number and find whether the number is an emrip number or
not. A number is called an emirp number if we get another prime number on reversing
the number itself. In other words, an emirp number is a number that is prime forwards or
backward. It is also known as twisted prime numbers.
Eg. Input n = 79, 79 and 97 both are prime numbers. Hence, 79 is a prime number.
11. Write a program to input a number. Check and display whether it is a Niven number or
not. (A number is said to be Niven which is divisible by the sum of its digits).
12. Palindrome Number in Java: Write a program to accept a number from the user and
check whether it is a Palindrome number or not. A number is a Palindrome which when
reads in reverse order is same as in the right order.
13. Write a program in Java to accept a number. Check and print whether it is a prime
number or not. A prime number is a number which is divisible by 1 and itself only.
2
14. Write a program in Java to accept a number. Check and print whether it is a Perfect
number or not: (A number is called Perfect if it is equal to the sum of its factors other
than the number itself.)
Example: 6 = 1 + 2 + 3
15. A special two-digit number is such that when the sum of its digits is added to the
product of its digits, the result is equal to the original two-digit number.
Example:
Consider the number 59.
Sum of digits = 5 + 9 = 14
Product of its digits = 5 x 9 = 45
Sum of sum of digits and product of digits = 14 + 45 = 59