-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsort.cpp
More file actions
34 lines (31 loc) · 734 Bytes
/
sort.cpp
File metadata and controls
34 lines (31 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*Given three numbers A, B, C. Print these numbers in ascending order followed by a blank line
and then the values in the sequence as they were read.*/
#include<iostream>
using namespace std;
int main() {
long long A,B,C;
long long z;
cin>>A>>B>>C;
if(A<=B&&A<=C){
cout<<A<<endl;
if(B<=C){
cout<<B<<endl<<C<<endl;
}else{cout<<C<<endl<<B<<endl;}
}
else if(B<=A&&B<=C){
cout<<B<<endl;
if(A<C){
cout<<A<<endl<<C<<endl;
}else{
cout<<C<<endl<<A<<endl;
}
}
else if(C<=A&&C<=B){
cout<<C<<endl;
if(B<A){
cout<<B<<endl<<A<<endl;
}else{ cout<<A<<endl<<B<<endl;}
}
cout<<endl<<A<<endl<<B<<endl<<C;
return 0;
}