#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int n,dangqianshu=1,jiechengshu=1;
printf("请输入n:");
scanf("%d",&n);
do
{
jiechengshu*=dangqianshu++;
}
while(dangqianshu<=n);
printf("n阶乘为:%d",jiechengshu);
return 0;
}
C语言do while实现n!
最新推荐文章于 2024-04-20 16:51:51 发布