var x = 1;
for (var i = 0; i < 3; i++) {
x += 5 * i;
}
console.log(x);
Answers
Answered by
1
Output :
16
Answer is 16 because :
x = 1
and loop executes till i becomes 2.
So,
x = 1 + ( 5 * 0 ) + ( 5 * 1 ) + ( 5 * 2 )
x = 1 + 0 + 5 + 10
x = 16
16
Answer is 16 because :
x = 1
and loop executes till i becomes 2.
So,
x = 1 + ( 5 * 0 ) + ( 5 * 1 ) + ( 5 * 2 )
x = 1 + 0 + 5 + 10
x = 16
Similar questions