The programming code below shows an ”if-else” function. After the code is run, the variable ”y” is equal to _______. int x,

Question

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; }

in progress 0
Kiệt Gia 3 years 2021-07-23T15:40:07+00:00 1 Answers 9 views 0

Answers ( )

    0
    2021-07-23T15:41:42+00:00

    Answer:

    2

    Step-by-step 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”

Leave an answer

Browse

Giải phương trình 1 ẩn: x + 2 - 2(x + 1) = -x . Hỏi x = ? ( )