题解 | 最大最小值

最大最小值

https://www.nowcoder.com/practice/051cbca4504d40f5b20bb891d83ec408

#include <stdio.h>

int main() {
    int a,b,c,max,min;
    scanf("%d%d%d",&a,&b,&c);
    if(a>b)
    {
        if(b>c)
        max=a,min=c;      
        else if(a>c)
        max=a,min=b;
        else
        max=c,min=b;
    }
    else
    {
        if(a>c)
        max=b,min=c;      
        else if(b>c)
        max=b,min=a;
        else
        max=c,min=a;
    }
    printf("The maximum number is : %d\nThe minimum number is : %d",
    max,min);
    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务