And Operator

And Operator:



And operator is used when we want that if both conditions given in the program are true then
it shows the output.

Program:

#include < iostream >
using namespace std;
int main()
{
int num;
cout << "Enter the number please" << endl;
cin >> num;
if (num == 1 && num > 0)
{
cout << "Entered number is a positive number" << endl;
}
else
{
cout << "Entered number is a negative number" << endl;
}
return 0;
}

Comments

Popular posts from this blog

How to display the output in C++