Monday, April 13, 2020

Logical operators in C




  • Program :

#include <stdio.h>
#include<conio.h>
void main()
{
    int a,b,c,d,e,f;
    clrscr();
    printf("\n----------------LOGICAL OPERATORS----------------");
    printf("\nEnter any three values:");
    scanf("%d%d%d",&a,&b,&c);
    printf("\n----------------LOGICAL OPERATOR(&&)----------------");
    d=(a==b)&&(c>b);
    printf("\nLogical AND is : %d",d);
    printf("\n----------------LOGICAL OPERATOR(||)----------------");
    e=(a==b)||(c<b);
    printf("\nLogical OR is : %d",e);
    printf("\n----------------LOGICAL OPERATOR(!=)----------------");
    f=!(a==b);
    printf("\nLogical NOT is : %d",f);
    getch();
}


  • Output :





No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...