The Program in C++ to Check largest Number among three integers is given below:
#include <iostream>
using namespace std;
int main() {
int num1, num2, num3;
cout<<"Hello Codeauri Family, Enter the 3 numbers respectively to find the largest one:\n";
cin>>num1>>num2>>num3;
int largest = num1;
if (num2 > largest) {
largest = num2;
}
if (num3 > largest) {
largest = num3;
}
cout << "The largest number is: " << largest << endl;
return 0;
}
Output:
Hello Codeauri Family, Enter the 3 numbers respectively to find the largest one:
5
6
7
The largest number is: 7
Pro-Tips💡
This program prompts the user to enter three integers,
then it compares the values of the integers and stores the largest one in the variable ‘largest’.
Finally, it prints out the largest number.
Learn C-Sharp ↗
C-sharp covers every topic to learn about C-Sharp thoroughly.
Learn C Programming ↗
C-Programming covers every topic to learn about C-Sharp thoroughly.
Learn C++ Programming↗
C++ covers every topic to learn about C-Sharp thoroughly.