Input 3 integer. Escape highest and lowest one.Print middle one.
#include<stdio.h>
int main()
{
int a,b,c,mid,t,i=0;
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d",&a,&b,&c);
if(a>b)
{
if(b>c)
mid=b;
else
{
if(a>c)
mid=c;
else
mid=a;
}
}
else if(a<b)
{
if(b<c)
mid=b;
else
{
if(a>c)
mid=a;
else
mid=c;
}
}
printf("Case %d: %d\n",(++i),mid);
}
return 0;
}
No comments:
Post a Comment