For Advertisements on this blog Contact Us at developgram@gmail.com or +91-9923438816

Simple Programming Tutorials For Beginners

Wednesday, April 19, 2017

Sum of Numbers (1 - 20)

<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>


No comments:

Post a Comment

SEARCH THIS BLOG