编五个C语言,简单的编程

来源:百度知道 编辑:UC知道 时间:2024/06/01 17:05:21
一共20分都给你但是,要正确, 非常感谢

我在学c语言,给你我的五个作业题吧。它们都是在Win-TC条件下运行的!希望对你有帮助!
第一题:
#include "stdio.h"
#include "conio.h"

main()
{
int p,r,m,n,t;
printf("Input two positive integers:");
scanf("%d,%d",&n,&m);
if(n<m)
{ t=n;
n=m;
m=t;
}
p=n*m;
while(m!=0)
{ r=n%m;
n=m;
m=r;
}
printf("the max number is:%d\n",n);
printf("the min number is:%d\n",p/n);
getch();
}
第二题:
#include "stdio.h"
#include "conio.h"

main()
{ float sum=0,t=1;
int i;
for(i=1;i<=20;i++)
{ t=t*i;
sum=sum+t;
}
printf("1!+2!+......+20!=%e\n",sum);
getch();
}
第三题:
#include "stdio.h"
#include "conio.h"