Description
Homelesser hates mathematics. He cannot even do addition and subtraction, not to mention computing factorial. He asks Cainiao2hao for help. Cainiao2hao is always busy solving more difficult problems. And now, please help Homelesser to compute factorial. If you cannot do it well, Cainiao2hao will think you are as fool as Homelesser.
Input
The first line contains only one integer T (T is about 10) indicates the number of test cases. For each case there are one integer n (0 ≤ n ≤ 10).
Output
One line for each case specifying the factorial of n.
Sample Input
2
4
3
Sample Output
24
6
(水题求阶乘)
题意:
有T组数据(0<T<=10)
后面T个正整数n(0<=n<=10)
没有坑直接写就可以
//AC代码
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
int t,n;
scanf("%d",&t);
while (t--)
{
long long ans=1;
scanf("%d",&n);
for (int i=1;i<=n;i++)
ans*=i;
printf("%lld\n",ans);
}
return 0;
}