View Code of Problem 91

    import java.util.Scanner;
     
    public class Main {
    	public static void main(String[] args) {
    		Scanner scanner = new Scanner(System.in);
    		int a = scanner.nextInt();
    		System.out.print(a+"=");
    		for(int i=2; i<=a;i++) {
    			while(a%i==0 && i!=a) {
    				a = a / i;
    				System.out.print(i + "*");
    			}
    			if(i==a) {
    				System.out.println(i);
    				break;
    			}
    		}
    	}
    }

Double click to view unformatted code.


Back to problem 91