-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNestedIfElse.cpp
75 lines (64 loc) · 1.05 KB
/
NestedIfElse.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <iostream>
using namespace std;
int main()
{
// int a, b, c, largest;
// cout<<"Enter three numbers:\n";
// cin>>a>>b>>c;
// if(a>b)
// {
// if(a>c)
// largest = a;
// else
// largest = c;
// }
// else{
// if(b>c)
// largest = b;
// else
// largest = c;
// }
// cout<<"Largest value is "<<largest<<endl;
//int x,y,z,large;
//cout<<"Enter value for x number: ";
//cin>>x;
//cout<<"Enter value for y number: ";
//cin>>y;
//cout<<"Enter value for z number: ";
//cin>>z;
//
//if(x>y)
//{
// if(x>z)
// large=x;
//
// else
// large=z;
//}else{
//
// if(y>z)
// large= y;
//
// else large= z;
//}
//cout<<"largest no: "<<large;
int jb,bg,em;
cout<<"Enter jeff bezos wealth: ";
cin>>jb;
cout<<"Enter bill gates wealth: ";
cin>>bg;
cout<<"Enter elon musk wealth: ";
cin>>em;
if(jb>bg)
{
if(jb>em)
cout<<"jef is the richest man";
else cout<<"elon musk is the richest";
}else
{
if(bg>em)
cout<<"bill is th richeat";
else cout<<"elon is the richest";
}
return 0;
}