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;
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM