Computer Science, asked by tarni16, 1 year ago

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
star089116: tarni
tarni16: hlo

Answers

Answered by sy3041432oyvsi9
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.";

                  }

}


sy3041432oyvsi9: #include

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.";

}

}
sy3041432oyvsi9: this is the answer...above code has mistakes
sy3041432oyvsi9: answer and comment both are correct...now answer is edited
Similar questions