asked 28.7k views
4 votes
The programming code below shows an ''if-else'' function. After the code is run, the variable ''y'' is equal to _______.

int x, y;
x = 0; y = 0;
if (x < 0) { y = y + 1; }
else { y = y + 2; }

1 Answer

4 votes

Answer:

2

Explanation:

Since x=0, and it's not <0, the "else statement" is executed making y=0+2

There is a category called "computer and technology", maybe you can get better answers if you select that instead of "mathematics"

answered
User RonyLoud
by
7.8k points

No related questions found

Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.