This website is preserved for historical and scholarly reference and is no longer actively maintained.
QUIZ 19
October 3, 1997
#1. Rewrite the following for-loop using a while-statment instead of a for-statement. Replace the for-loop entirely, including any statements necessay for correct logical operation. ( 5 points )
for ( k = first ; k <= last ; k++ )
{
System.out.println ( "k squared = " + (k * k) );
}
#2. 6! = ____________ ( 3 points )
#3. Complete the following function which computes n!. ( 2 points )
public static int factorial ( int n )
{
int factor = 1;
int product = 1;
// insert code here
return product;
}