Or Operator
Or Operator
Or operator is used when we want that if any one of the given condition in the program is true thenit 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 << "Type the number again" << endl;
}
return 0;
}
Comments
Post a Comment