Ok so here is what I have so far... It's not giving me the correct answer and I can't get it to loop... I also have to try to make it so when a user inputs -999 the program will stop...
package proj3laa;
import javax.swing.*;
import java.text.*;
public class Factorial
{
public static void main(String[] args)
{
int num;
int factorial;
factorial=1;
num=1;
String s1;
s1=JOptionPane.showInputDialog("Input a number");
num=Integer.parseInt(s1);
while (num>=0 && num!=-999)
{//start while
factorial= num*(num-1);
System.out.print(factorial);
num--;
}//end while
}
}
*edit- well I figured out how to allow a user to input a number and then the prog outputs all of the numbers below it. (ex user inputs 5 prog outputs: 543231) But i dont know how to get it to multiply those numbers. or anywhere close to what I need it to do besides that....
int factorial;
String s1;
factorial=1;
s1=JOptionPane.showInputDialog("Input a number");
factorial=Integer.parseInt(s1);
while (factorial >0)
{//start while
System.out.print (factorial);
factorial--;
}//end while