JAVA PROGRAMMING, WILL GIVE BRAINLIEST, PLS
Here are the instructions:
Debug the program so it prints the factorial of a positive integer entered by the user. This is calculated by multiplying all the numbers from 1 up to that number together. For example, 5 factorial is 5*4*3*2*1 = 120.
Here is the code:
import java. Util. Scanner;
public class U4_L1_5_Activity_Two{
public static void main(String[] args){
Scanner scan = new Scanner(System. In);
int num = scan. NextInt();
while(num >= 0){
int prod = 1;
num--;
prod = prod*num;
}
System. Out. Println(prod);
}
}