while循环练习题
import java.util.Scanner;
public class Demo {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("请输入要计算的阶乘");
int num = input.nextInt();
int count = 1;
int pro = 1;
while (count <= num) {
pro = pro * count;
count++;
}
System.out.println(num + "的阶乘是" + pro);
}
}