Posts

Showing posts from January, 2020

Factorial HTML

Factorial Coding <html> <head> <script> function show(){ var i, no, fact; fact=1; no=1; no=Number(document.getElementById("num").value); for(i=1; i<=no; i++) { fact= fact*i; } document.getElementById("answer").value= fact; } </script> </head> <body> Enter num: <input id= "num"> <button onclick="show()">Factorial</button> <input id="answer"> </body> </html> Factorial Output Enter num: Factorial

Smallest num HTML

Smallest num Coding <html> <head> <script> function Smallest() { var num1, num2, num3; num1 = Number(document.getElementById("N").value); num2 = Number(document.getElementById("M").value); num3 = Number(document.getElementById("O").value); if(num1<num2 && num1<num3) { window.alert(num1+"-is Smallest"); } else if(num2<num1 && num2<num3) { window.alert(num2+"-is Smallest"); } else if(num3<num1 && num3<num1) { window.alert(num3+"-is Smallest"); } } </script> </head> <body> <form> <h1>Calculate Smallest among three numbers</h1> <hr color="pink"> <br> Enter number 1: <input type="text" id="N"></input><br> Enter number 2: <input type="text" id="M"></input><br> Enter number 3: <input type="text" i...

Largest num HTML

Largest Num Coding <html> <head> <script> function largest() { var num1, num2, num3; num1 = Number(document.getElementById("N").value); num2 = Number(document.getElementById("M").value); num3 = Number(document.getElementById("O").value); if(num1>num2 && num1>num3) { window.alert(num1+"-is greatest"); } else if(num2>num1 && num2>num3) { window.alert(num2+"-is greatest"); } else if(num3>num1 && num3>num1) { window.alert(num3+"-is greatest"); } } </script> </head> <body> <form> <h1>Calculate largest among three numbers</h1> <hr color="yellow"> <br> Enter number 1: <input type="text" id="N"></input><br> Enter number 2: <input type="text" id="M"></input><br> Enter number 3: <input type="text" id=...

Calculator HTML

Calculate coding <html> <head> <body> <form name="calculator"> <table> <tr> <td colspan="4"> <input disabled="" id="display" name="display" type="text" /> </td> </tr> <tr> <td><input name="one" onclick="calculator.display.value += '1'" type="button" value="1" /></td> <td><input name="two" onclick="calculator.display.value +='2'" type="button" value="2" /></td> <td><input name="three" onclick="calculator.display.value +='3'" type="button" value="3" /></td> <td><input class="operator" name="plus" onclick="calculator.display.value +='+'" type="button" value="+" /></td> </tr...