Beecrowd 1042 Simple Sort Solution in C,Cpp

Beecrowd 1042 Simple Sort Solution

Question

Solution in C

#include<stdio.h>

int main() {
int a,b,c,temp,x,y,z;

scanf("%d%d%d",&a,&b,&c);
x=a;
y=b;
z=c;
if(a>b){
temp=a;
a=b;
b=temp;
}
if(a>c){
temp=a;
a=c;
c=temp;
}
if(b>c){
temp=b;
b=c;
c=temp;
}
printf("%d\n%d\n%d\n\n",a,b,c);

printf("%d\n%d\n%d\n",x,y,z);

return 0;

}

Next problem solution: Beecrowd -1043 Triangle Solution in C & C++

Leave a Comment