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);
}
}
博客主要围绕Java中的while循环展开,提供了相关练习题,有助于巩固对Java语言里while循环的理解和运用,属于信息技术领域中后端开发的Java编程范畴。
1545

被折叠的 条评论
为什么被折叠?



