Consider the following code segment. What is the value of result after the code segment is executed? (WILL GIVE BRAINLIEST IF CORRECT)
A) 6
B) 10
C) 15
D) 21

Consider the following code segment What is the value of result after the code segment is executed WILL GIVE BRAINLIEST IF CORRECT A 6 B 10 C 15 D 21 class=

Respuesta :

Answer:

A) 6

Explanation:

initially x=0,result=0;

the loop executes the first time and changes the values to be 1 and 1

the loop executes the second time and changes the values to be 2 and 2

the loop executes the third time and changes the values to be 3 and 3

the loop executes the fourth time and changes the values to be 4 and 4

the loop executes the fifth time and changes the values to be 5 and 5

and it executes one more time because 5 is not greater than 5

the loop executes the sixth time and changes the values to be 6 and 6

the loop does not execute again because the value of x>5

ACCESS MORE