Computer Science, asked by yahya78shujaat, 4 days ago

C++ program which takes 3 numbers from user and display whether they are equal or not
instead of two I want a program which takes three numbers​

Answers

Answered by BrainlyProgrammer
3

Answer:

#include <iostream>

using namespace std;

int main(){

   //program which takes 3 numbers from user and display whether they are equal or not

   int a,b,c;

   cout<<"Enter 3 numbers: ";

   cin>>a>>b>>c;

   if(a==b && b==c)

       cout<<"All numbers are equal";

   else

       cout<<"All numbers are not equal";

   return 0;

}

Explanation:

  • First we will define header and tell compiler to use namespace std.
  • Then we will declare 3 variables and take 3 inputs from the user.
  • Now, as mentioned in the question, display whether they are equal or not. We will apply a condition that all 3 numbers should be equal (a==b && b==c)
  • if the condition is true, it displays "equal" message otherwise not,
Similar questions