Program:
Test Cases:
<html> <head> <script type="text/javascript"> function display() { console.log("Hello"); var n=Number(document.getElementById("num").value); if(n%2==0) { document.writeln("Number is EVEN"); } else { document.writeln("Number is ODD"); } document.writeln("<br/><br/><br/> Number 1 to "+n+" is:"); for(i=1;i<=n;i++) { document.writeln(i); } document.writeln("<br/><br/><br/> Displaying Number in Words: "); switch(n) { case 1: document.writeln("One"); break; case 2: document.writeln("Two"); break; case 3: document.writeln("Three"); break; case 4: document.writeln("Four"); break; case 5: document.writeln("Five"); break; default: document.writeln(" To display number in words enter less than 5 "); break; } } </script> </head> <body bgcolor="grad"> Enter any Number: <input type="text" id="num"/> <button onclick="display()"> Display </button> </body> </html>
Test Cases: