Find the largest number out of three given values in C++

Using Visual Studio 2015

===============================================================


#include<iostream>
using namespace std;
#include<conio.h>
void main()
{
 int num1,num2,num3;
 cout<<"Enter first number= ";
 cin>>num1;
 cout << "Enter second number= ";
 cin >> num2;
 cout << "Enter third number= ";
 cin >> num3;
 if (num1 > num2&&num1 > num3)
 {
  cout<<num1<<" is the largest number";
 }
 else if(num2 > num1&&num2 > num3)
 {
  cout << num2 << " is the largest number";
 }
 else if (num3 > num1&&num3 > num2)
 {
  cout << num3 << " is the largest number";
 }
 _getche();
}


==========================================================================

Comments

Popular posts from this blog

Suppose you are given a square matrix of size n x n, write a program to determine if this is an identity matrix. 2D array

Program to create a multiplication table of a given number using while loop.

Program to find equal values using if statement in C++