need help with a loop for class...
Heres the program description the instructor gave us for class...
Program Description: Write a program that finds the factorial of a value entered by the user. To calculate 12! (12 factorial) for example the program should calculate the value of
1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x 12.
The program should continue processing numbers until the user inputs a zero. Be sure not to process the terminal value (zero).
When you are finished submit the completed program to your instructor.
and here is the code ive got so far
the think im having trouble with is getting the numbers to multiply differently each time and having the user cut it off in time. Could you help me out please
public class Prog162a
public static void main(String args)
System.out.println("Enter a Number [Zero to quit]");
Scanner a = new Scanner(System.in);
int z = 0;
int b = 0;
int aa = a.nextInt();
while (aa<=aa * 12 +1)
b = aa*1;
b = aa*2;
System.out.println("The value of " + aa +"! is" + b);
Re: need help with a loop for class...
Suggestion: take a look at for-loops.