[山东科技大学OJ]2620 Problem G: max()函数(Append Code)

 

Time Limit: 1 Sec  Memory Limit: 2 MB
Submit: 1296  Solved: 683
[Submit][Status]

Description

编写一个函数max(),返回三个参数中的最大整数。

 

max()函数的调用格式见append.c

 

 

Input

输入为三个整数。

 

 

Output

输出为三个整数中的最大值。

 

 

Sample Input

15 10 20

Sample Output

20

HINT

 

Append Code

[Submit][Status]


#include <stdio.h>
int max(int a,int b,int c)
{
    if(a>b)
    {
        int temp=a;
        a=b;
        b=temp;
    }
    if(b>c)
    {
        int temp=b;
        b=c;
        c=temp;
    }
    if(a>b)
    {
        int temp=a;
        a=b;
        b=temp;
    }
    return c;
}
 
int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    printf("%d\n", max(a, b, c));
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值