1. Write a program in Java to accept a number from user and print the digits in Vertically reverse.
2. Write a program in Java to accept a number from user and print the sum of the digits.
3. Write a program in Java to accept a number from user and print the greatest digit.
For example 37825
The greatest digit is 8
4. Write a program in Java to accept a number from user and print the smallest digit.
5. Write a program in Java to accept a number from user and print the greatest and smallest digits.
6. Write a program in Java to accept a number from user and print the number as a Reverse Whole number.
[Input: 123 (One Hundred Twenty Three)
Output: 321 (Three Hundred Twenty One)]
Note: You don't need to print the number in Words.
7. Write a program in Java to accept a number from user and print the number is Palindrome or not.
8. Write a program in Java to accept a number from user and check if it is a Neon number or not.
A Neon number is a number where the sum of digits of square of the number is equal to the number. For example if the input number is 9, its square is 9*9 = 81 and sum of the digits is 9. i.e. 9 is a Neon number.
9. Armstrong Number in Java: Armstrong number is a number that is equal to the sum of cubes of its digits for example 0, 1, 153, 370, 371, 407 etc.
Let's try to understand why 153 is an Armstrong number.
153 = (1*1*1)+(5*5*5)+(3*3*3)
where:
(1*1*1)=1
(5*5*5)=125
(3*3*3)=27
So:
1+125+27=153
10. A special two-digit number is such that when the sum of the 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 the digits and product of digits = 14 + 45 = 59
Write a program to accept a two-digit number. Add the sum of its digits to the product of its digits. If the value is equal to the number input, output the message “special-two digit number” otherwise, output the message “Not a special two-digit number”.
Example: 29
11. Write a program to accept a number and check and display whether it is a spy number or not.
(A number is spy if the sum its digits equals the product of the digits.)
Example: consider the number 1124,sum of the digits = 1 + 1 + 2 + 4= 8
Product of the digits = 1 x 1 x 2 x 4=8
More examples of Spy Numbers are: 123, 132, 1241, 1412, 4211.
12. Any positive integer which is divisible by the sum of its digits is a Harshad Number or Niven Number.
Let us see a few examples where we will determine whether the given number is a Harshad Number or not.
16 7(6+1) No.(16 is not divisible by 7)
102 3(1+0+2) Yes.(102 is divisible by 3)
152 8(1+5+2) Yes.(152 is divisible by 8)
200 2(2+0+0) Yes.(200 is divisible by 2)
13. Write a Program in Java to check whether the number is a Dudeney number, a number is Dudeney if the cube of the sum of the digits is equal to the number itself.
Eg : 512
=(5+1+2)3 = (8)3 =512
More examples of Dudeney Numbers are: 1, 4913, 17576, 19683.
14. A number is said to be a Jupiter number if it is completely divisible by the sum of its first and last digit. Write a program to accept a number, verify whether it is a Jupiter number or not and display a relevant output message. If the user enters 0 or any negative number print the message “Invalid number entered”.
Let the number be 162. The sum of its first digit and last digit is = 1 + 2 = 3 And, 162 is completely divisible by 3. So, 162 is a Jupiter number.
More examples of Jupiter Numbers are: 126, 231, 405
15. Write a Program in Java to input a number and check whether it is a Disarium Number or not.
Note: A number will be called DISARIUM if sum of its digits powered with their respective position is equal to the original number.
For example 135 is a DISARIUM
(Workings 11+32+53 = 135, some other DISARIUM are 89, 175, 518, 598, 1306, 1676 etc)
16. Write a program in Java to check whether the number given by the user is a Krishna Murthy number or not.
Krishna Murthy Number : It is a number which is equal to the sum of the factorials of all its digits.
For example : 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145
Krishna Murthy Number : It is a number which is equal to the sum of the factorials of all its digits.
For example : 145 = 1! + 4! + 5! = 1 + 24 + 120 = 145
More example: 40585
17. Write a Program in Java to input a number and check whether it is a Unique Number or not.
Note: A Unique number is a positive integer (without leading zeros) with no duplicate digits.
For example 7, 135, 214 are all unique numbers whereas 33, 3121, 300 are not.
18. Write a Program in Java to check if Number is Buzz Number or not.
Buzz Number: A number is said to be Buzz Number if it ends with 7 or is divisible by 7.
Example: 1007 is a Buzz Number as it end with 7. 343 is also a Buzz Number as it is divisible by 7 and 77777 is also a Buzz Number as it ends with 7 and also it is divisible by 7.
19. Write a Program in Java to input a number and check whether it is a Pronic Number or Heteromecic Number or not.
Pronic Number : A pronic number, oblong number, rectangular number or heteromecic 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, 240, 272, 306, 342, 380, 420, 462 … etc.
20. A perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself. Equivalently, a perfect number is a number that is half the sum of all of its positive divisors.
The first perfect number is 6, because 1, 2 and 3 are its proper positive divisors, and 1 + 2 + 3 = 6. Equivalently, the number 6 is equal to half the sum of all its positive divisors: ( 1 + 2 + 3 + 6 ) / 2 = 6.
More examples of Perfect Number: 28, 496, 8128.
21. A Moran number is a number, when divided by the sum of its digits, generates a prime number. and the sum of the digits of the number should be the factor of that number. 45 is a Moran number: The sum of the digits of the number 45 is 4 + 5 = 9, and when 45 is divided by 9, we get 45 / 9 = 5, and 5 is a prime number. Hence, 45 is a Moran number.
More examples of Moran number are :18, 21, 57, 42, 63, 84, 111.