Monday 10 February 2020

Simple cpp program with if else statement to check if the numbers are equal or not

Source Code:

#include<iostream>
using namespace std;
int main()
{
int x,y,z;
cout<<"Enter X: ";
cin>>x;
cout<<"Enter Y: ";
cin>>y;
cout<<"Enter Z: ";
cin>>z;
if(x=y==z)
{
cout<<"The numbers are equal";
}
else
{
cout<<"The universe has collapsed";
}
return 0;
}

Program Output:

No comments:

Post a Comment