Program to find largest number among three numbers

#include "iostream"
using namespace std;
void main() {
float    number1, number2, number3;
cout << "Plz enter three numbers: ";
cin >> number1 >> number2 >> number3;
if(number1 >= number2 && number1 >= number3)
cout << "Largest number: " << number1;
if(number2 >= number1 && number2 >= number3)
cout << "Largest number: " << number2;
if(number3 >= number1 && number3 >= number2)
cout << "Largest number: " << number3;
}
Output
Plz enter three numbers: 10
20
15
Largest number: 20

Post a Comment

0 Comments