C-programming - Logical operator, C++ logical operator

Logical operator

The logical operators are used to combine two or more test expressions. The logical operators of c++ are ! (not), && (and), || (or).\\

#include
void main()
{
int num;
cout << \"Enter the number:\"<< endl;
cin >> num;
if ((num!=0) &&((num%2)==0))
{
cout << \"Even digit is entered\"<< endl;
}
else
{
cout << \"Odd digit is entered\"< }



Output

Enter the number: 8
Even digit is entered

The topic on C-programming - Logical operator is posted by - Malar

Hope you have enjoyed, C-programming - Logical operatorThanks for your time

Tech Bluff