import java.util.Scanner;
public class JPA401 {
static Scanner keyboard = new Scanner(System.in);
public static void main(String args[]) {
int input=0;
System.out.println("Input n(0<=n<=16)");
input=keyboard.nextInt();
while(input!=999){
System.out.println(input+"的階層 = "+k(input));
System.out.println("Input n(0<=n<=16)");
input=keyboard.nextInt();
}
}
static int k(int x){
if(x>1){
return x*k(x-1);
}
else{
return 1;
}
}
}
沒有留言:
張貼留言