C语言的考题 急用 在线等

来源:百度知道 编辑:UC知道 时间:2024/09/20 16:58:57
C语言课程设计复习提纲
1、利用分支结构找出三个整形变量的最大值。
2、利用分支结构判断输入的三个正整数是否能组成三角形。
3、利用循环结构设计求5!。
4、利用循环结构设计求1+2+3+4……+20。
5、设计程序实现求一维整数数组a[10]的最大值。
6、设计程序实现求一维整数数组a[10]的所有元素的和。
7、设计子函数实现求两个整数的和,这两个数由主函数输入,结果也在主函数打印出来。
8、设计子函数实现求两个整数的积,这两个数由主函数输入,结果也在主函数打印出来。
9、设计子函数实现求整数数组a[10]所有元素的平均值,数组值从主函数输入,结果从主函数输出。
10、设计实现对整数数组a[10]进行排序。并将排序结果输出。

题1:
#include<stdio.h>
int main()
{
int a,b,c,d,max;
printf("please input three numbers:\n");
scanf("%d %d %d",&a,&b,&c);
if(a>b)
d=a;
else d=b;
if(d>c) max=d;
else max=c;
printf("The max of the three number is:%d\n",max);
return 0;
}
题2:
#include<stdio.h>
int main()
{
int a,b,c;
printf("please input three numbers:\n");
scanf("%d %d %d",&a,&b,&c);
if(a+b>c&&a-b<c&&a+c>b&&a-c<b)
printf("The three number can Constitute triangle.\n");
else printf("The three number can not Constitute triangle.\n");
return 0;
}
题3:
#include<stdio.h>
int main()
{
int i=1,s=1;
while(i<=5)
{
s=s*i;
i++;
}
printf("5!=%d&#