A program which calculate factorial from 1-9 by iteration
<p>I am trying to write a program which can calculate factorial from 1-9 by iteration, but I encounter some problems while I am trying to. Please help me figure out my problems in my program, I am just learning programming.</p>

<p>The following is my program, please tell me what's wrong with it:</p>

<pre><code>public class iterative {
    static int ans=1;
    public static void iteration() {
        System.out.println("n n!");

        for (int n=1; n&lt;10; n++) {
            while ((n-1)&gt;0)
                ans=n*(n-1);
            System.out.println(n + " " + ans);
        }

    }


    public static void main(String[] args) {
        iteration();
    }
}
</code></pre>
