赞
踩
- import java.util.Scanner;
-
- public class Test12 {
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int sum=1;
- Scanner sc = new Scanner(System.in);
- System.out.println("请输入一个整数:");
- int k = sc.nextInt();
- for (int i = 1; i <= k; i++) {
- sum=sum*i;
- }
- System.out.println(k+"的阶乘为:"+sum);
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。