#include<stdio.h>
int main()
{
int i, n;
int b = 1;
printf("please enter the n:\n");
scanf_s("%d", &n); //输入n
if (n < 0) //判断输入的n是否为正数
return -1;
else
{
for (i = 1; i <= n; i++ )
{
b = i * b; //计算部分
}
printf("%d\n", b);
}
return 0;
}
C语言解决n!的问题
猜你喜欢
转载自blog.csdn.net/qq_32100603/article/details/112134126
今日推荐
周排行