In: Computer Science
The class FindFac discussed in this chapter prints the factors of all numbers from 1 to 100. Modify this class so that, instead of stopping at 100, it keeps going until it finds a number with exactly nine factors. This is a Java program
public class FindFac {
    public static void main(String[] args) {
        for(int i = 0;i<=100;i++){
            System.out.print("Factors of "+i+" are: ");
            for(int j = 1;j<=i;j++){
                if(i%j==0){
                    System.out.print(j+" ");
                }
            }
            System.out.println();
        }
    }
}
//////////////////////////////////////////////////////////////////////////////////////
public class FindFac {
    public static void main(String[] args) {
        int count;
        for(int i = 0;i<=100;i++){
            count = 0;
            System.out.print("Factors of "+i+" are: ");
            for(int j = 1;j<=i;j++){
                if(i%j==0){
                    System.out.print(j+" ");
                    count++;
                }
            }
            System.out.println();
            if(count==9){
                break;
            }
        }
    }
}