Isc Computer Project #3
Isc Computer Project #3
Question: A Fascinating number is one which when multiplied by 2 and 3 and then, after the
results are concatenated with the original number, the new number contains all the digits from
1 to 9 exactly once. There can be any number of zeroes and are to be ignored.
Write a program to display all Fascinating numbers that are in the range between m and n
(both inclusive) and output them along with the frequency.
Algorithm:
Step 1: START
Sub-Steps:
2.1: Set chk = true;
2.2: Set a loop for char i=’1’ till i<=9, i++. if s.indexOf(i)= -1
or s.indexOf(i) != s.lastIndexOf(i), set chk = false and
break
2.3: Return chk
Sub-Steps:
6.1: If check(i + "" + (i * 2) + "" + (i * 3)) = true, go to step
6.2 else go to step 7
6.2: Print i and increase f by 1
Source Code:
import java.util.Scanner;
public class Fascinating {
long f = 0;
System.out.println("\nFrequency:" + f);
} //end of main
} //end of class
Variable Description: