Program:
Output:
<!DOCTYPE html> <html> <body> <center> <h1> Printing Odd Number from 1 to 100 </h1> <br> <br> <p id="print"> </p> </center> <script type='text/JavaScript'> var res=""; for(i=1;i<100;i++) { var n = 2; if(i%2 !=0) { res = res + i +" "; } } document.getElementById("print").innerHTML = res; </script> </body> </html>
Output: