C-programming - Logical operartor, C++ logical operator
Logical operartor
The logical operators are used to combine two or more test expressions. The logical operators of c++ are ! (not), && (and), || (or).\
#include <iostream.h>
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"<<endl;
}
Output
Enter the number: 8 Even digit is entered
The topic on C-programming - Logical operartor is posted by - Malar
Hope you have enjoyed, C-programming - Logical operartorThanks for your time