Write a Program to Find the Greatest of Three Numbers

C++ program to find the greatest number of three numbers .The if block will be run if the Boolean statement evaluates to true; else, the else block will be executed. Any non-zero and non-null values are assumed to be true in the C++ programming language, while zero and null values are assumed to be false.

#include <iostream>
using namespace std;

int main()
float a, b, c;
cout << "Enter three numbers";
cin >> a >> b >> c;
if(a >= b && a >= c)
cout << "Largest number" << a;
if(b >= a && b >= c)
cout << "Largest number" << b;
if(c >= a && c >= b)
cout << "Largest number" << c;
return 0;



Enter three numbers

Largest number


What is float variable in c++ program

A variable of the floating point type can hold a real value, such as 50.0. The floating portion of the name relates to the decimal point’s ability to “float,” that is, to support a variable number of digits before and after the decimal point.

What is if else statement in c++

Conditional branching is controlled by an if-else expression. If the condition evaluates to a non-zero value, the if-branch statements are performed or true. If the condition’s value is non zero, the next statement is run, and the line after the optional else is skipped.

Similar Programs