Click Here to see the problem detail.
Solution
The source code is enough to understand the problem.
Source Code
#include<stdio.h> int main() { int testCase,salary[3],temp; scanf("%d",&testCase); int c=1; while(testCase--) { scanf("%d%d%d",&salary[0],&salary[1],&salary[2]); int flag=1; int j=1,i; while(flag) { flag=0; for(i=0; i<3-j; i++) if(salary[i]<salary[i+1]) { temp=salary[i]; salary[i]=salary[i+1]; salary[i+1]=temp; flag=1; } } printf("Case %d: %d\n",c,salary[1]); c++; } return 0; }
Next Previous