标签:style blog http color io 2014 ar div
1 /** 2 * @declare: 递归求N的阶乘<br> 3 * @author: cphmvp 4 * @version: 1.0 5 * @date: 2014年7月30日上午10:02:32 6 */ 7 public class Factorial { 8 9 public static void main(String[] args) { 10 11 Scanner scanner = new Scanner(System.in); 12 int n = scanner.nextInt(); 13 System.out.println(factorial(n)); 14 } 15 16 public static int factorial(int n) { 17 if (n == 1) { 18 return 1; 19 } else { 20 return n * factorial(n - 1); 21 } 22 } 23 24 }
标签:style blog http color io 2014 ar div
原文地址:http://www.cnblogs.com/cphmvp/p/3877333.html