Created
April 17, 2015 18:31
-
-
Save shohan4556/9725080930930b7087c2 to your computer and use it in GitHub Desktop.
UVA : 11727 - Cost Cutting solution in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Author: Shohanur Rahaman | |
// UVA : 11727 | |
#include<stdio.h> | |
void sort(int array_size,int array[]); | |
int salary[3]; | |
int main() | |
{ | |
int count; | |
int tc; | |
count=0; | |
scanf("%d",&tc); | |
count=0; | |
while(tc>0){ | |
count++; | |
scanf("%d %d %d",&salary[0],&salary[1],&salary[2]); | |
sort(3,salary); | |
printf("Case %d: %d\n",count,salary[1]); | |
tc--; | |
} | |
return 0; | |
} | |
void sort(int array_size,int array[]) | |
{ | |
int i,j,tmp; | |
for(i=0;i<array_size;i++){ | |
for(j=i;j<array_size;j++){ | |
if(array[i]>=array[j]){ | |
tmp=array[i]; | |
array[i]=array[j]; | |
array[j]=tmp; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment