URI - BEECROWD - BEE Online Judge Solution 1042 | Simple Sort - URI - BEECROWD - BEE 1042 Solution in C,C++,Python
Read three integers and sort them in ascending order. After, print these values in ascending order, a blank line and then the values in the sequence as they were readed.
Input
The input contains three integer numbers.
Output
Present the output as requested above.
Input Sample | Output Sample |
7 21 -14 | -14 |
-14 21 7 | -14 |
URI Online Judge Solution 1041 | Coordinates of a Point - URI 1041 Solution in C,C++,Python :
#include<stdio.h>
int main(){
int a,b,c,aux;
int v[3];
scanf("%d %d %d", &a, &b, &c);
v[0] = a;
v[1] = b;
v[2] = c;
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
if(v[i] < v[j]){
aux = v[j];
v[j] = v[i];
v[i] = aux;
}
}
}
printf("%d\n%d\n%d\n", v[0], v[1], v[2]);
printf("\n%d\n%d\n%d\n", a, b, c);
return 0;
}
0 Response to URI - BEECROWD - BEE 1042 | Simple Sort Solution in C,C++,Python | URI - BEECROWD - BEE 1042 Solution
Post a Comment