forked from eupdate/cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathascending.cpp
53 lines (43 loc) · 926 Bytes
/
ascending.cpp
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
*Project:18;
*Author:Samitha Hewawasam;
*Date:2015-06-05;
*Tool:atom text editor;
*Compiler:g++;
*OS:ubuntu 14.04;
*Extra Tools: astyle prity print
*/
#include <iostream>
void main() {
//let's get 3 integer varibles to hold 3 numbers
int a,b,c;
//ask from user to enter those
cout<<"Enter your 1st number?\n";
cin>>a;
cout<<"Enter your 2nd number?\n";
cin>>b;
cout<<"Enter your 3rd number?\n";
cin>>c;
cout<<"\nAscending Order is bellow\n";
if(a < b && a < c) {
cout<<a<<endl;
if(b < c) {
cout<<b<<endl;
cout<<c<<endl;
}
}
else if(b < a && b < c) {
cout<<b<<endl;
if(a < c) {
cout<<a<<endl;
cout<<c<<endl;
}
}
else if(c < a && c < b) {
cout<<c<<endl;
if(a < b) {
cout<<a<<endl;
cout<<b<<endl;
}
}
}