-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path_22.LargestNumber.cpp
More file actions
51 lines (48 loc) · 1.11 KB
/
_22.LargestNumber.cpp
File metadata and controls
51 lines (48 loc) · 1.11 KB
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
#include <iostream>
using namespace std;
int main()
{
float num1, num2, num3;
cout << "Enter first number: ";
cin >> num1;
cout << endl << "Enter second number: ";
cin >> num2;
cout << endl << "Enter third number: ";
cin >> num3;
if (num1 >= num2)
{
if (num1 >= num3)
{
cout << num1 << " is the largest " << endl;
}
/*
num1 is greater than or equal to num2
but num1 is not greater than or equal to num3
so, num3 is the largest
*/
else
{
cout << num3 << " is the largest " << endl;
}
/*
else num 2 is greater than num1
if num2 is greater than equal to num3 ----> num2 is the largest
*/
}
else
{
if (num2 >= num3)
{
cout << num2 << " is the largest " << endl;
}
/*
else num2 is greater than num1
but num2 is not greater than or equal to num3----> num3 is the largest
*/
else
{
cout << num3 << " is the largest " << endl;
}
}
return 0;
}