Hi guys, I don't understand what i'm doing wrong here. I'm supposed to print factorial of the inserted integer.
1. first to ask the number (for example 3)
2. count its factorial and print it on the screen (6) 1*2*3 = 6
Here's my code
import java.io.*;
public class factorial {
public static void main(String[] args) throws IOException {
int i, num, factori;
factori = num;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for(num<0; num=<factori) {
System.out.print("Insert number:"); {
num = Integer.parseInt(in.readLine());
System.out.println("The factorial of" +num+ "is" +factori);
}
}
}
Thanks