Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Monday 19 December 2016

Simple calculator in html

<html>
<head>
<title>
Calculator</title>
<style>
h1{color:blue;}
</style>
</head>
<body bgcolor="black">
<h1><center><u><marquee  direction="right" scrollamount="20" bgcolor="yellow">Simple Calculator</marquee></u></center></h1>
<br/>
<form Name="Claculator" >
<table border=2 cellspacing="2" cellpadding="10" align="center" bordercolor="red">
<tr>
<td colspan=4><input type=text Name="display" placeholder="enter number"></td>
</tr>
<tr>
<td><input type=button value="+" OnClick="Claculator.display.value +='+'"></td>
<td><input type=button value="-" OnClick="Claculator.display.value+='-'"></td>
<td><input type=button value="x" OnClick="Claculator.display.value+='*'"></td>

</tr>
<tr>
<td><input type=button value="C" OnClick="Claculator.display.value=''"></td>
<td><input type=button value="/" OnClick="Claculator.display.value+='/'"></td>
<td><input type=button value="%" OnClick="Claculator.display.value+='%'"></td>

</tr >
<tr><td><input type=button value="=" OnClick="Claculator.display.value=eval(Claculator.display.value)"></td>

</tr>
</table>
</form>
</body>
</html>

No comments:

Post a Comment