1 package FushiExam; 2 import java.util.*; 3 public class Text_22 { 4 5 public static void main(String[] args) { 6 // 利用递归方法求n! 7 Scanner scan=new Scanner(System.in); 8 int n=scan.nextInt(); 9 int sum=Fin(n); 10 System.out.println(n+"!="+sum); 11 12 } 13 public static int Fin(int a) { 14 if(a==1) 15 return 1; 16 else 17 return a*Fin(a-1); 18 } 19 20 }