C Programming :: Basic Concepts - Discussion
Home > C Programming > Basic Concepts > MCQs Questions Discussion
28 / 90
What is the output of the following program ?
#include<stdio.h>
int main()
{
int a;
if (a=0)
printf("a is zero");
else
printf ("a is not zero");
return 0;
}
#include<stdio.h>
int main()
{
int a;
if (a=0)
printf("a is zero");
else
printf ("a is not zero");
return 0;
}
Aa is zero
Bnothing
Ca is not zero
Dgarbage
Answer: Option (Login/Signup)
Show Explanation
Therefore, else block will get executed and the output will be a is not zero.
Asked In ::
STEP-BY-STEP
Here, inside if we are actually initializing a=0, and we know that "0 is not equal to 0" will result to False, hence if block won't get executed.
Therefore, else block will get executed and the output will be a is not zero.
Read Full Answer
Report Error
Please Login First Click Here