Ask Question

Predict the output

the following is a segment of program

x=1 y=1

if (n>0)

{

x=x+1

y=y+1

}

what will be the value of x and y if n assumes a value

1, 0

+4
Answers (1)
  1. 8 May, 04:20
    0
    If n is 0, then nothing happens because m is not greater than 0.

    If n is 1, then x is 2 and y is 2.

    Explanation:

    The if condition is true (1>0), so x becomes 1+1 and y becomes 1+1.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Predict the output the following is a segment of program x=1 y=1 if (n>0) { x=x+1 y=y+1 } what will be the value of x and y if n assumes a ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers