Program List For Competition
1) Write a Program in Java to input a number and check whether it is a Fascinating Number or not.
Fascinating Numbers: Some numbers of 3 digits or more exhibit a very interesting property. The property is such that, when the number is multiplied by 2 and 3, and both these products are concatenated with the original number, all digits from 1 to 9 are present exactly once, regardless of the number of zeroes.
Let's understand the concept of Fascinating Number through the following example:
Consider the number 192
192 x 1 = 192
192 x 2 = 384
192 x 3 = 576
Concatenating the results: 192 384 576
It could be observed that '192384576' consists of all digits from 1 to 9 exactly once. Hence, it could be concluded that 192 is a Fascinating Number. Some examples of fascinating Numbers are: 192, 219, 273, 327, 1902, 1920, 2019 etc.
2) 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 that is divisible by 1 and itself only. For example 2, 3, 5, 7, 11, 13 are all prime numbers.
3) Write a program to input a number and check and print whether it is a Pronic number or not. [Pronic number is the number that is the product of two consecutive integers.]
Examples:12 = 3 * 4
20 = 4 * 5
42 = 6 * 7
Example:
Consider the number 512.
Sum of digits = 5 + 1 + 2 = 8
Cube root of 512 = 8
As Sum of digits = Cube root of Number hence 512 is a Dudeney number.
5) Write a program to input a number and count the number of digits. The program further checks whether the number contains an odd number of digits or even number of digits.
Sample Input: 749
Sample Output: Number of digits=3
The number contains odd number of digits.
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
DeleteThank you sir..
ReplyDelete- Soham Punjal