Shares
facebook sharing button Share
twitter sharing button Tweet
email sharing button Email
linkedin sharing button Share
reddit sharing button Share
tumblr sharing button Share
blogger sharing button Share
print sharing button Print
skype sharing button Share
sms sharing button Share
whatsapp sharing button Share
arrow_left sharing button
arrow_right sharing button

C Logical Operators - C++ operators - AND, OR, NOT

<<Previous

Next >>




Logical Operators

Logical Operators are used to check the logical relationship between two expressions. After evaluating the conditions, it provides logical true (non-zero value) or logical false (zero value) status. Here, the operands can be constants, variable and expressions.

  Operator      Name      Description      Example    
&&Logical AND if both conditions are true, then it returns true5 > 3 && 5 < 10 is true
| |Logical ORif any one of two conditions is true, then it returns true5 < 3 | | 5 < 10 is true
! Logical NOTif the conditions is false, then it returns true!(5 > 3) is false

Example

Following is an example C Program using Logical Operators.

#include <stdio.h>
#include <conio.h>

int main()
{
   int a=5;
   int b=3;

   if((a>3)&&(a<10)){
	    printf("The Logical AND Expression is True\n");
   } else{
	    printf("The Logical AND Expression is False\n ");
   }

   if((b>a) || (b<10)){
		printf("The Logical OR Expression is True \n ");
   } else{
		printf("The Logical OR Expression is False \n ");
   }

   if(!(a>b)){
		printf("The Logical NOT Expression is True \n ");
   } else{
		printf("The Logical NOT Expression is False \n");
   }
	 return(0);
 }
 

Output

The Logical AND Expression is True
The Logical OR Expression is True
The Logical NOT Expression is False

<< Previous

Next >>




strcat() - String Concatenation        strcmp() - String Compare


strcpy() - String Copy        strlen() - String Length














C Logical Operators - C++ operators - AND, OR, NOT

<<Previous

Next >>




Logical Operators

Logical Operators are used to check the logical relationship between two expressions. After evaluating the conditions, it provides logical true (non-zero value) or logical false (zero value) status. Here, the operands can be constants, variable and expressions.

  Operator      Name      Description      Example    
&&Logical AND if both conditions are true, then it returns true5 > 3 && 5 < 10 is true
| |Logical ORif any one of two conditions is true, then it returns true5 < 3 | | 5 < 10 is true
! Logical NOTif the conditions is false, then it returns true!(5 > 3) is false

Example

Following is an example C Program using Logical Operators.

#include <stdio.h>
#include <conio.h>

int main()
{
   int a=5;
   int b=3;

   if((a>3)&&(a<10)){
	    printf("The Logical AND Expression is True\n");
   } else{
	    printf("The Logical AND Expression is False\n ");
   }

   if((b>a) || (b<10)){
		printf("The Logical OR Expression is True \n ");
   } else{
		printf("The Logical OR Expression is False \n ");
   }

   if(!(a>b)){
		printf("The Logical NOT Expression is True \n ");
   } else{
		printf("The Logical NOT Expression is False \n");
   }
	 return(0);
 }
 

Output

The Logical AND Expression is True
The Logical OR Expression is True
The Logical NOT Expression is False

<< Previous

Next >>






strncat() - String n Concatenation        strlwr() - String Lower       

strncmp() - String n Compare       strncpy() - String n Copy