public class Test {
public static void main (String[] args)
{
long result = 1;
for (int i = 1; i <= 10; i++)
{
result *= i;
System.out.println(result);
}
}
}
屏输出:
1
2
6
24
120
720
5040
40320
362880
3628800
int temp = 1;
for(int i =1;i<=10;i++){
temp*=i;
}