Computer Science, asked by spandan1526, 1 year ago


5. Predict the output :
x = 40
y = x + 1
X = 20, y + x
print (x, y)
6. Predict the output​

Answers

Answered by Somriddha
44

Answer:

when x=40

y=40+1=41

when x=20

y+x=41+20=61

System. out. println(x, y);

Answered by lovingheart
23

Answer:

61,41 (The output depends on the programming language too)

Explanation:

The first statement assigns x as 40 then y gets x + 1 which is 40 + 1 = 41, again x is reassigned to the value of 20 and then y + x is assigned so now x gets 41+20 = 61. Finally x,y is printed as 61, 41.

The same program might end up in error in programming language such as c, c++, java because they all are case sensitive. Here in one place x is in lower case and in other place it is in upper.

Similar questions