Write a program that prompts the user to input a number 'n', and then print the i-th factorial number defined as follows:
F(0) = 1, F(1) = 1, F(2) = 1x2, and F( n ) =1x2x3x…x(n-2)x(n-1)xn
撰寫一個程式,令使用者輸入數字'n',然後輸出定義如下的第i個階乘數:
F(0) = 1, F(1) = 1, F(2) = 1x2, and F( n ) =1x2x3x…x(n-2)x(n-1)xn
The input consists of M cases. The first line of the input contains only one positive integer M, followed by M cases. Each case consists of exactly one line with one integer n, 0 ≤ n ≤ 12.
輸入由M個案例組成。 輸入的第一行只包含一個正整數M,後跟M個案例。 每種情況恰好包含一行,其中一個整數n,0≤n≤12。
For each case, print exactly one line containing only one integer: the i-th factorial number.
對於每種案例,輸出只包含一個整數的一行:第i個階乘數。
3 1 3 5
1 6 120
編號 | 身分 | 題目 | 主題 | 人氣 | 發表日期 |
沒有發現任何「解題報告」 |