用C语言,求n!,n从键盘输入.(要求分别用WHILE语句,DO-WHILE语句、FOR语句三种语句分别实现)

问题描述:

用C语言,求n!,n从键盘输入.(要求分别用WHILE语句,DO-WHILE语句、FOR语句三种语句分别实现)

int n;
longs=1;
printf("input n:");
scanf("%D",&n);
while(n>1)
{
s=s*n;
n--;
}
printf("result:%l,s);
//***dowhile
int n;
longs=1;
printf("input n:");
scanf("%D",&n);
do{s=s*n;n--;}while(n>1);
printf("result:%l",s);
//***-for
int n,i;
longs=1;
printf("input n:");
scanf("%D",&n);
for(i=1;i