Friday, February 24, 2012

program primefactor

import jeliot.io.*;

public class MyClass {
    public static void main() {
    int nUserInput;
    nUserInput = Input.readInt();
    for(int nIterator = 2; nIterator <= nUserInput; nIterator++)
    {
             if((nUserInput % nIterator) == 0)
             {
                            System.out.print(nIterator);
                            nUserInput /= nIterator;
                            nIterator = 1;
                            if(nIterator != nUserInput)
                            {
                                         System.out.print(" * ");
                            }
             }
    }

    }
}

No comments:

Post a Comment