Hey Everyone,
I'm new to JCreator and trying to compile this program, however I keep getting "missing return statement"...please help.
import javax.swing.JOptionPane;
public class DoCount {
public static void main(String[] args) {
String nString=JOptionPane.showInputDialog("Enter n:");
int n = Integer.parseInt(nString);
factorial(n);
}
public static int factorial(int n){
int count = n;
if (n < 0){
System.out.println("exit");
}
else if (n == 0){
System.out.println("n==0");
}
else{
while(count>0){
n=n*(count-1);
}
return n;
}
}
}