以下是使用C语言编写比较三个数大小的代码:

#include <stdio.h>

int main()
{
    int a, b, c;

    printf("请输入三个整数:\n");
    scanf("%d %d %d", &a, &b, &c);

    if(a > b && a > c)
    {
        printf("%d 最大\n", a);
    }
    else if(b > a && b > c)
    {
        printf("%d 最大\n", b);
    }
    else
    {
        printf("%d 最大\n", c);
    }

    return 0;
}

运行程序后,用户需要输入三个整数,程序会比较它们的大小并输出最大值。

C语言比较三个数大小 - 代码示例和解释

原文地址: https://www.cveoy.top/t/topic/oKzP 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录