title: using a do-while loop to validate user input and then allow valid input to be displayed
body: <p>I have this assignment to make this allow the user to put a valid input and display the result using a do while loop. Right now it works to allow the user input but wont display the result from the counter var. any help would be great thanks </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>alert("Sum the Numbers Application");
  
  var sum = 0;
  var num = parseInt(prompt("Enter the top numbers to sum", "5"));
  for (var i = 1; i &lt;= num; i++) {
    sum += i;
  }
  if (num &lt;= 0 || num &gt; 100 || isNaN(num)) {
    alert("Not a valid entry.");
  } else {
    alert("Sum of the numbers from 1 through " + num + " is " + sum + ".")
  }
  
  do {
    var num = parseInt(prompt("Enter the top numbers to sum", "5"));
  }
  while (num &lt;= 0 || num &gt; 100 || isNaN(num))</code></pre>
  </div>
  </div>
  </p>