C语言大一如图所示,做任意三道
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/21 13:48:14
C语言大一如图所示,做任意三道
C语言大一
如图所示,做任意三道
C语言大一如图所示,做任意三道
//2 a
#include<stdio.h>
int main()
{
int temp[15] = {0};
int value = 0,sum = 0;
for(int i = 0;scanf("%d",&value)&&i<15;++i){
temp[i] = value;
sum+=value;
}
for(int i = 0;i<15;++i)
printf("%d ",temp[i]);
printf("\n%d\n",sum/15);
return 0;
}
//2 b
int main()
{
.
int max = 0;
for(int i = 0;scanf("%d",&value)&&i<15;++i)
.
max<value? max = value : max = max;
...
printf("Max = %d\n",max);
}
//2 c
int main()
{
int n = 0;
for(...)
if(max<value){
max = value;
n = i;
}
.
printf("The maximum value is %d\nThis is element number %d in the list of numbers",max,n);
}
//2 d
int main(){
..
for(..)
i = 0? max = value: max>value? max = value: max = max;
...
}