Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
Last active December 22, 2021 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McLarenCollege/4eafa49b107a303dd21a1b93439d55a1 to your computer and use it in GitHub Desktop.
Save McLarenCollege/4eafa49b107a303dd21a1b93439d55a1 to your computer and use it in GitHub Desktop.
Exercise : Sum of Even Numbers

Given variables fromNum and toNum, calculate the sum of all the even numbers from fromNum to toNum using while loop. Value of fromNum will be always be less than or equal to toNum.

CODE TEMPLATE


let fromNum = 6;
let toNum = 12;
let sum = 0;
// write your code here
console.log(sum);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment