What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 0, y = 2, z = 3;
int a = x & y | z;
printf(“%d”, a);
}
a) 3
b) 0
c) 2
d) Run time error
Answer: a
Related Posts
What will be the output of the following C code?
#include < stdio.h >
void main()
{
int x = 5;
if (true);
printf(“hello”);
}What will be the output of the following C code?
#include < stdio.h >
int x;
void main()
{
if (x)
printf(“hi”);
else
printf(“how are u”);
}What will be the output of the following C code?
#include < stdio.h >
void main()
{
int x = 5;
if (x < 1)
printf(“hello”);
if (x == 5)
printf(“hi”);
else
printf(“no”);
}What will be the output of the following C code?
#include <stdio.h>
void main()
{
char a = ‘A’;
char b = ‘B’;
int c = a + b % 3 – 3 * 2;
printf(“%d\n”, c);
}What will be the output of the following C code?
#include <stdio.h>
void main()
{
char a = ‘0’;
char b = ‘m’;
int c = a && b || ‘1’;
printf(“%d\n”, c);
}What will be the output of the following C code?
#include <stdio.h>
void main()
{
int a = 2 + 3 – 4 + 8 – 5 % 4;
printf(“%d\n”, a);
}What will be the output of the following C code?
#include <stdio.h>
void main()
{
int h = 8;
int b = 4 * 6 + 3 * 4 < 3 ? 4 : 3;
printf(“%d\n”, b);
}
Join The Discussion