C program for Logical Operators:
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,d,e,f;
clrscr();
printf("Enter the value of a:");
scanf("%d",&a);
printf("Enter the value of b:");
scanf("%d",&b);
printf("Enter the value of c:");
scanf("%d",&c);
d=(a>b)&&(a>c);
e=(a>b)||(a>c);
f=!(a>b);
printf("\nAND=%d",d);
printf("\nOR=%d",e);
printf("\nNOT=%d",f);
getch();
}
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,d,e,f;
clrscr();
printf("Enter the value of a:");
scanf("%d",&a);
printf("Enter the value of b:");
scanf("%d",&b);
printf("Enter the value of c:");
scanf("%d",&c);
d=(a>b)&&(a>c);
e=(a>b)||(a>c);
f=!(a>b);
printf("\nAND=%d",d);
printf("\nOR=%d",e);
printf("\nNOT=%d",f);
getch();
}
No comments:
Post a Comment