Javascript quiz#1 solution Q2 part 2

in javascriptquiz •  4 years ago 

Q2)

  1. print series of number as 2000 , 1800 , 1600 , ........ , -2000 and also print how many terms will be there for covering the series from 2000 to -2000.

Ans 2.

Screenshot (249).png

var count = 0;
for (var i = 2000; i >= -2000; i -= 200) {
count++;
console.log(i);
}

console.log(count);

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!