C语言实现:键盘输入三个数字,输出最大值

时间:2020-08-02 10:02:33   收藏:0   阅读:134
求三个数字的最大值

#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
//max函数
int max(int a, int b, int c)
{
    int temp;
    if (a > b && a > c)
        temp = a;
    if (b > a && b > c)
        temp = b;
    if (c > a && c > b)
        temp = c;
}

int main()
{
    int a, b, c;
    printf("请输入三个数字:");
    scanf("%d%d%d",&a,&b,&c);
    printf("三个数字的最大值为: %d ", max(a, b, c));
    return 0;
}
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!