32.6k views
9 votes
In the code below, what's the final value of the variable x?

var x = 10;
X = x + 7;
X = X* 3;
A:51
B:34
C:10
D:21

2 Answers

0 votes
If bar x = 10 ;

Where you see the var x replace it with 10.

X = x + 7
X = 10 + 7 = 17

Substitute the value of the first var X in the equation

X = X* 3
X = 17 * 3 = 51

Therefore the final value of var x is 51 option A
User Michael West
by
5.0k points
4 votes
A 51

x=10 so we substitute 10 into the spots for x in the beginning

x=10+7

x=17*3

x=51
User Yohjp
by
5.0k points