import java.util.Scanner; class xuanze{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int jc = 1; System.out.println("请输入一个数值"); int shu = sc.nextInt(); //for(int x=1;x<=shu;x++){ 1*数都等于1,可以从2开始 for(int x=2;x<=shu;x++){ jc *=x; } System.out.println(shu+"的阶乘="+jc); } }
java_2018_Day15_乘阶(for)
猜你喜欢
转载自www.cnblogs.com/dlbm/p/9192270.html
今日推荐
周排行