Java Number Programs (ISC Classes 11 / 12)
- Java Iterative Stmts- 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.View Answer- 164 Likes 
- Java Iterative Stmts- A number is said to Bouncy number if the digits of the number are unsorted. - For example, 
 22344 - It is not a Bouncy number because the digits are sorted in ascending order.
 774410 - It is not a Bouncy number because the digits are sorted in descending order.
 155349 - It is a Bouncy number because the digits are unsorted.
 A number below 100 can never be a Bouncy number.- Write a program in java to accept a number. Check and display whether it is a Bouncy number or not. View Answer- 76 Likes 
- Java Iterative Stmts- An Evil number is a positive whole number which has even number of 1's in its binary equivalent. Example: Binary equivalent of 9 is 1001, which contains even number of 1's. A few evil numbers are 3, 5, 6, 9…. Design a program to accept a positive whole number and find the binary equivalent of the number and count the number of 1's in it and display whether it is a Evil number or not with an appropriate message. Output the result in format given below: - Example 1 
 Input: 15
 Binary Equivalent: 1111
 No. of 1's: 4
 Output: Evil Number- Example 2 
 Input: 26
 Binary Equivalent: 11010
 No. of 1's: 3
 Output: Not an Evil NumberView Answer- 91 Likes 
- Java Iterative Stmts- A triangular number is formed by the addition of consecutive integers starting with 1. For example, 
 1 + 2 = 3
 1 + 2 + 3 = 6
 1 + 2 + 3 + 4 = 10
 1 + 2 + 3 + 4 + 5 = 15
 Thus, 3, 6, 10, 15, are triangular numbers.
 Write a program in Java to display all the triangular numbers from 3 to n, taking the value of n as an input.View Answer- 59 Likes 
- Java Iterative Stmts- A Smith number is a composite number, whose sum of the digits is equal to the sum of its prime factors. For example: 
 4, 22, 27, 58, 85, 94, 121 ………. are Smith numbers.- Write a program in Java to enter a number and check whether it is a Smith number or not. - Sample Input: 666 
 Sum of the digits: 6 + 6 + 6 = 18
 Prime factors are: 2, 3, 3, 37
 Sum of the digits of the prime factors: 2 + 3 + 3 + (3 + 7) = 18
 Thus, 666 is a Smith Number.View Answer- 67 Likes 
- Java Iterative Stmts- A unique-digit integer is a positive integer (without leading zeros) with no duplicates digits. For example 7, 135, 214 are all unique-digit integers whereas 33, 3121, 300 are not. Given two positive integers m and n, where m < n, write a program to determine how many unique-digit integers are there in the range between m and n (both inclusive) and output them. The input contains two positive integers m and n. Assume m < 30000 and n < 30000. You are to output the number of unique-digit integers in the specified range along with their values in the format specified below: - Sample Input: 
 m = 100
 n = 120
 Sample Output:
 The Unique-Digit integers are:
 102, 103, 104, 105, 106, 107, 108, 109, 120.
 Frequency of unique-digit integers is : 9- Sample Input: 
 m = 2500
 n = 2550
 Sample Output:
 The Unique-Digit integers are:
 2501, 2503, 2504, 2506, 2507, 2508, 2509, 2510, 2513, 2514, 2516, 2517, 2518, 2517, 2530, 2519, 2530, 2531, 2534, 2536, 2537, 2538, 2539, 2540, 2541, 2543, 2546, 2547, 2548, 2549.
 Frequency of unique-digit integers is: 28.View Answer- 55 Likes 
- Java Iterative Stmts- A Composite Magic number is a positive integer which is composite as well as a magic number. - Composite number: A composite number is a number which has more than two factors. 
 For example:
 Factors of 10 are: 1, 2, 5, 10- Magic number: A Magic number is a number in which the eventual sum of the digit is equal to 1. 
 For example: 28 = 2+8=10= 1+0=1- Accept two positive integers 'm' and 'n', where m is less than n. Display the number of composite magic integers that are in the range between m and n (both inclusive) and output them along with frequency, in the format specified below: - Sample Input: 
 m=10 n=100
 Output: The composite magic numbers are 10,28,46,55,64,82,91,100
 Frequency of composite magic numbers: 8- Sample Input: 
 m=120 n=90
 Output: Invalid inputView Answer- 59 Likes 
- User Defined Methods- A Goldbach number is a positive even integer that can be expressed as the sum of two odd primes. - Note: All even integer numbers greater than 4 are Goldbach numbers. - Example: - 6 = 3 + 3 
 10 = 3 + 7
 10 = 5 + 5- Hence, 6 has one odd prime pair 3 and 3. Similarly, 10 has two odd prime pairs, i.e. 3 and 7, 5 and 5. - Write a program to accept an even integer 'N' where N > 9 and N < 50. Find all the odd prime pairs whose sum is equal to the number 'N'. - Test your program with the following data and some random data: - Example 1 - INPUT: 
 N = 14- OUTPUT: 
 PRIME PAIRS ARE:
 3, 11
 7, 7- Example 2 - INPUT: 
 N = 30- OUTPUT: 
 PRIME PAIRS ARE:
 7, 23
 11, 19
 13, 17- Example 3 - INPUT: 
 N = 17- OUTPUT: 
 INVALID INPUT. NUMBER IS ODD.- Example 4 - INPUT: 
 N = 126- OUTPUT: 
 INVALID INPUT. NUMBER OUT OF RANGE.View Answer- 71 Likes 
- User Defined Methods- Write a program to input a three digit number. Use a method int Armstrong(int n) to accept the number. The method returns 1, if the number is Armstrong, otherwise zero(0). - Sample Input: 153 
 Sample Output: 153 ⇒ 13 + 53 + 33 = 153
 It is an Armstrong Number.View Answer- 468 Likes 
- Java Iterative Stmts- 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. - Sample Input: 242 
 Sample Output: A Palindrome number- Sample Input: 467 
 Sample Output: Not a Palindrome numberView Answer- 257 Likes 
Showing 1 - 10 of 29 Questions