Skip to content

Instantly share code, notes, and snippets.

@AntonisFK
Created April 6, 2016 05:58
Show Gist options
  • Save AntonisFK/e902d4c309f5a777a64db0d38a2f27d2 to your computer and use it in GitHub Desktop.
Save AntonisFK/e902d4c309f5a777a64db0d38a2f27d2 to your computer and use it in GitHub Desktop.
Write a program that would print the sum of all the odd numbers from 1 to 5000
//Write a program that would print the sum of all the odd numbers from 1 to 5000
var sum = 0;
for(var i=1; i<=5000; i=i+2){
sum += i;
}
console.log(sum);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment