write a program to input three Numbers and check whether they are equal or not . If they are unequal numbers then display the greatest among them otherwise display the message 'all the numbers are equal' .
star089116:
hi
Answers
Answered by
10
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cout << "Type three numbers: ";
cin >> a;
cin >> b;
cin >> c;
if(a==b && b==c)
{
cout << "All the numbers are equal";
}else if(a>b && a>c)
{
cout << a << " is greatest.";
}else if(b>a && b>c)
{
cout << b << " is greatest.";
}else if(c>a && c>b)
{
cout << c << " is greatest.";
}else
{
cout << "Any two numbers are equal. Please enter numbers such that all are equal or none is equal.";
}
}
using namespace std;
int main()
{
int a,b,c;
cout << "Type three numbers: ";
cin >> a;
cin >> b;
cin >> c;
if(a==b && b==c)
{
cout << "All the numbers are equal";
}else if(a>b && a>c)
{
cout << a << " is greatest.";
}else if(b>a && b>c)
{
cout << b << " is greatest.";
}else if(c>a && c>b)
{
cout << c << " is greatest.";
}else
{
cout << "Any two numbers are equal. Please enter numbers such that all are equal or none is equal.";
}
}
Similar questions