118k views
5 votes
What is the value of the variable named result after the following code executes?

var X = 5; var Y = 3; var Z = 2;

var result = ( X + Y ) / Z * X;

User Elwc
by
3.4k points

1 Answer

3 votes

Answer:

The value of result is 20

Step-by-step explanation:

Given

The above code segment

Required

The value of result

In the first line, we have:


X = 5; Y = 3; Z = 2

In the second, we have:


result = (X + Y)/Z * X

This implies that:


result = (5 + 3)/2 * 5


result = 8/2 * 5


result = 4 * 5


result = 20

User ThomasRS
by
4.1k points