C语言实验——找中间数

Problem Description

输入三个整数,找出其中的中间数。(这里的中间数指的是大小,不是位置。)

Input

输入3个整数。

Output

输出中间数。

Example Input

1 2 3

Example Output

2

#include<stdio.h>
int main()
{
int a,b,c;
int t;

scanf("%d %d %d",&a,&b,&c);
if(b>a)
{
t=a;
a=b;
b=t;
}
if(c>a)
{
t=a;
a=c;
c=t;
}
if(c>b)
{
t=b;
b=c;
c=t;
}
printf("%d",b);

return 0;
}

猜你喜欢

转载自www.cnblogs.com/my122/p/9836559.html