// purpose: set elements of an array to factorial values import java.util.*; public class ArrayFactorial { public static void main( String[] args ) { // get a scanner for standard input Scanner stdin = new Scanner( System.in ); // determine the desired array size System.out.println(); System.out.print( "Enter number of elements: " ); int n = stdin.nextInt(); System.out.println(); // create the array int[] list = new int[ n ]; // set the n elements to represent the values of the factorials // 0!, 1!, ... (n-1)! // suggestion: by the Factorial definition 0! is 1. Handle that first. // The other elements can be handle by peeking at the previous elements list[ 0 ] = 1; for ( int i = i; i < n; ++i ) { } // display the array for ( int i = 0; i < n; ++i ) { System.out.print( list[ i ] + " " ); } System.out.println(); System.out.println(); } }