Solve the following:
Question is based on logical operators and relations operators
#include<stdio.h>
int main()
{
int a=10,b=20,c;
/* 1. */
c=a>=10 && b>=a;
printf("1. %d\n",c);
/* 2. */
c=a<=10 && b>=a;
printf("2. %d\n",c);
/* 3. */
c=a>=6 && b<=a;
printf("3. %d\n",c);
/* 4. */
c=!(a>=130 && b>=a);
printf("4. %d\n",c);
/* 5. */
c=a>=10 && !(b>=a);
printf("5. %d\n",c);
return(0);
}
/* Output */ 1. 1 2. 1 3. 0 4. 1 5. 0
Solve the following:
Question is based on logical operators and relations operators
#include<stdio.h>
int main()
{
int a=10,b=20,c;
/* 1. */
c=!(a>=b) && b>=18;
printf("1. %d\n",c);
/* 2. */
c=!(!(a<=310) && !(b>=a));
printf("2. %d\n",c);
/* 3. */
c=a && b;
printf("3. %d\n",c);
/* 4. */
c=!a && b;
printf("4. %d\n",c);
/* 5. */
c=!(a && b);
printf("5. %d\n",c);
return(0);
}
/* Output */ 1. 1 2. 1 3. 1 4. 0 5. 0




