C program to demonstrate the working of logical operators

// C program to demonstrate the working of logical operators:-

#include<stdio.h>
#include<conio.h>
void main()
{
    int a,b,c,value;
    clrscr();
    printf("Enter Three integer numbers : \n");
    scanf("%d%d%d",&a,&b,&c);
    printf("You Entered A=%d , B=%d , c=%d:\n\n",a,b,c);
    if(a>b&&a>c)               //AND Operator
    printf("a is greatest number:\n\n");
    else if(b>c)
    printf("b is greatest number:\n\n");
    else
    printf("c is greatest number:\n\n");
    value=(!(a=b))||(a>b);     //OR and NOT Operator
    printf("Result of ((!a=b))||(a>b) is : %d \n",value);
    getch();
}

=======================
OUTPUT:-

Enter Three integer numbers :
3 4 5                                                                          
You Entered A=3 , B=4 , c=5:                                                   
                                                                               
c is greatest number:                                                          
                                                                                
Result of ((!a=b))||(a>b) is : 0  
=======================                        
C program to demonstrate the working of logical operators

Comments