Sum of Numbers (1 - 20)

By Developgram - April 19, 2017

<html>
<body>
  <script>
    var sum = 0, i = 1;

    while(i<=20)
    {
      sum = parseInt(sum + i);
      i++;
    }

    document.write("Sum of numbers between 1- 20 is " + sum);
  </script>
</body>
</html>


  • Share:

You Might Also Like

0 comments