What is the output of C Program.?
int main()
{
int a=9;
if(a=8)
{
printf("Kangaroo\n");
}
printf("Eggs\n");
return 0;
}
=======================================
A) No output
B) Eggs
C) Kangaroo
Eggs
D) Compiler error
Answers
Answered by
1
Answer:
option C is correct
Explanation:
becoz value will be change due to initialization of variable a... hence , kangaroo will print on the screen and again Eggs will print also
Answered by
0
Answer: Option (C) is correct.
Concept:
The object provided by the left operand takes a value using assignment operators and this operator returns the assigned value.
Find:
What is the output of the given program?
Solution:
As is an assignment statement, it will return the assigned value 8.
The if condition will become true for any number except for 0.
Therefore, statements under if condition will get executed.
So, will get executed, and then .
Output:
Kangaroo
Eggs
Hence, option (C) is correct.
Similar questions