Created
April 6, 2016 05:58
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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