هذا برنامج المضروب
كود PHP:
import java.util.Scanner;
public class FactorialFor {
public static void main(String[] args) {
int fact = 1;
Scanner input=new Scanner(System.in);
System.out.println("Enter the number to find the factorial of : ");
int num=input.nextInt();
for(int i =1 ; i<=num ; i++){
fact= fact*(i);
}
System.out.println("The factorial is: " + fact);
}
}