C语言 输入若干整数,以-1结束,去掉最大值和最小值,求平均值。#程序员 #知识分享 #c语言 #网课 #线上教学 - 瑞老师于20221113发布在抖音,已经收获了43个喜欢,来抖音,记录美好生活!
&a,&b,&c); 输入1┌┐2┌┐3←┐ 则输出a,b,c的话结果是:1,┌┐,2。 在这里,输出的不...
include\x0d\x0aint main()\x0d\x0a{\x0d\x0afloat std[100],sum=0;\x0d\x0aint i=0,num;\x0d\x0aprintf("输入学生成绩,以-1结束:");\x0d\x0afor(;i<100;i++)\x0d\x0a{\x0d\x0ascanf("%f",&std[i]);\x0d\x0aif(std[i] == -1) break;\x0d\...
include<stdio.h> int main(){ int n = 0, m = 0,s[];for(;n != -1;){ scanf("%d",&n);s[i]=n;i++;m = m + 1;} printf("个数为:%d\n",m);for(int i=0;i<m;i++)printf("%d\n",s[i]);return 0;} ...
//求数组总和 num--;} ret=sum/ret; //求平均值 return ret;} void main(){ int age[100],i=0;float average;printf("请输入年龄:");do{ scanf("%d",&age[i]);i++;}while(age[i-1]!=-1);average=Average(age,i-1);printf("本组平均年龄为:%.1f\n",average);} ...
{ scanf("%d",arr[i]);//输入前n-1个数 } arr[i]=-1;//以-1结束 for(i=0;i!=1n;i++){ if(arr[i]>max) max = arr[i];//求最大值 } 这是核心语句,我希望你可以自己加上程序框架,使其成为完整的程序。这是c语言较基础的程序了,如果连这个都要在网上找答案,那么将来的...
{ int score;while(1){ scanf("%d",&score);if(score == -1) return 0; //输入-1则结束 if...
{ return a>b? a:(b>c? b:c);} int getMin(int a,int b,int c){ return a<b? a:(b<c? b:c);} void main(){ int a,b,c;printf("Please input three numbers:\n");scanf("%d",&a);scanf("%d",&b);scanf("%d",&c);printf("the max number is:%d\n",getMax(a...
include <stdio.h>void main() // 改成 int main (){ int score, max, min, average, sum, i = 1; scanf("%d\n", &score); // 如果这时候输入是 -1 呢 sum = max = min = score; while (score != -1) { // 这种应该用 do while scanf("%d", &...
include <stdio.h> include <stdlib.h> int main(){int max,min,num;printf("Input numbers,-1 to end:\n");scanf("%d",&num);max=min=num;while(num!=-1){ if(num>max)max=num;if(num<min)min=num;scanf("%d",&num);} printf("max:%d,min:%d\n",max,min);system("pause...