🎴 Flashcard Mode

C Programming - 2

Card1 / 50
Mastered0
Review0
QuestionClick to flip

What is the value of variable POLYGON?
main()
{
int POLYGON, L, B; L=B =2; POLYGON = (L==B) ? 1 : 0;
}

AnswerClick to flip back
A
1
💡 Explanation:

The ternary operator (L==B) ? 1 : 0 checks if L equals B. Since both are assigned 2, the condition is true, resulting in the value 1.

Change Mode