#include <stdio.h>
int main(int argc, char const *argv[])
{
int n, i = 1, sum = 1;
printf("请输入一个数:\n");
scanf("%d", &n);
while(i <= n)
{
sum = sum*i;
i++;
}
printf("n! is %d\n", sum);
return 0;
}
2024-03-29 09:18:10
#include <stdio.h>
int main(int argc, char const *argv[])
{
int n, i = 1, sum = 1;
printf("请输入一个数:\n");
scanf("%d", &n);
while(i <= n)
{
sum = sum*i;
i++;
}
printf("n! is %d\n", sum);
return 0;
}
下一篇:带参程序