#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,jiecheng=1;
printf("请输入n:");
scanf("%d",&n);
while(dangqianshu<=n)
{
jiecheng*=dangqianshu;
dangqianshu++;
}
printf("阶乘是%d",jiecheng);
return 0;
}
C语言用while求n!
最新推荐文章于 2024-05-31 19:42:50 发布