Javascript for Statement Sum the Even Integers from 2 to 100

Introduction

Summation with the for repetition structure.


let sum = 0;/*from   w w w  . j  a v a 2 s.c  o m*/

for ( let number = 2; number <= 100; number += 2)
   sum += number;

console.log( "The sum of the even integers " + "from 2 to 100 is " + sum );



PreviousNext

Related