题解 | 最大最小值

最大最小值

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

#include <stdio.h>

int main() {
    
    int a = 0, b = 0, c = 0;
    scanf("%d%d%d", &a, &b, &c);

    int max = a, min = a;
    //求最大
    if (max < b) {
        max = b;
        if (max < c) {
            max = c;
        }
    }
    //求最小
    if (min > b) {
        min = b;
        if (min > c) {
            min = c;
        }
    }
    printf("The maximum number is : %d\n", max);
    printf("The minimum number is : %d", min);

    return 0;
}

全部评论

相关推荐

06-19 19:06
门头沟学院 Java
码农索隆:别去东软,真学不到东西,真事
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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