相加和最大值

Description

输入三个整数a,b,c。并进行两两相加,最后比较相加和的最大值。

Input

输入数据包含三个整数,用空格分开。

Output

输出两两相加后的最大值。

Sample

Input 

1 2 3

Output 

5

#include <stdio.h>
int main()
{
    int a,b,c,a1,a2,a3,max;
    scanf("%d %d %d",&a,&b,&c);
    a1 = a + b;
    a2 = a + c;
    a3 = b + c;
    if(a1 > a2){
        max = a1;
    }
    if(a2 > a1){
        max = a2;
    }
    if(max < a3){
        a1 = max;
        max = a3;
    }
    printf("%d",max);
}
温馨提示: 本文最后更新于2020-12-04,至今已有1233天,某些文章具有时效性,若有错误或已失效,请在下方留言
© 版权声明
THE END
喜欢就支持一下吧❀
点赞0投币 分享
评论 抢沙发

    请登录后查看评论内容