
2条回答 默认 最新
CSDN专家-link 2021-11-24 22:02关注那不就是求最大的两个数么
#include <stdio.h> int main() { int a[10],i,max1,max2; for(i=0;i<10;i++) { scanf("%d",&a[i]); if(i==0) max1 = max2 = 0; else { if(max1 < a[i]) { max2 = max1; max1 = a[i]; } else if(max2 < a[i]) max2 = a[i]; } } printf("%d %d",max1+max2,max1*max2); return 0; }解决 无用评论 打赏 举报 编辑记录