Coder Social home page Coder Social logo

henriquesantos12 / calculadora Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 5 KB

Fiz uma calculadora utilizando javascript, deem uma conferida e utilize ela pra te ajudar na sua rotina matemática

Home Page: https://henriquesantos12.github.io/Calculadora/

License: MIT License

HTML 100.00%
calculator html javascript logica-de-programacao matematica

calculadora's Introduction

Calculadora

Fiz uma calculadora utilizando javascript

<title>Micro Calculadora</title> <style type="text/css"> input[type=number]{ width: 100%; padding: 12px 20px; margin: 8px 0; box-sizing: border-box; border: 2px solid #ccc; border-radius: 4px; background-color: #f8f8f8; font-size: 20px; }
	input[type=button]{
		background-color: #4CAF50;
		border: none;
		color: white;
		padding: 16px 32px;
		text-decoration: none;
		margin: 4px 2px;
		cursor: pointer;
		font-size: 20px;
	}
</style>

Micro Calculadora

<input type="button" value="+" onclick="add()">
<input type="button" value="-" onclick="sub()">
<input type="button" value="*" onclick="mul()">
<input type="button" value="/" onclick="div()">

<p id="result"></p>

<script type="text/javascript">
	function add(){
		var num1 = parseInt(document.getElementById('num1').value);
		var num2 = parseInt(document.getElementById('num2').value);
		var result = num1 + num2;
		document.getElementById('result').innerHTML = "Resultado: " + result;
	}

	function sub(){
		var num1 = parseInt(document.getElementById('num1').value);
		var num2 = parseInt(document.getElementById('num2').value);
		var result = num1 - num2;
		document.getElementById('result').innerHTML = "Resultado: " + result;
	}

	function mul(){
		var num1 = parseInt(document.getElementById('num1').value);
		var num2 = parseInt(document.getElementById('num2').value);
		var result = num1 * num2;
		document.getElementById('result').innerHTML = "Resultado: " + result;
	}

	function div(){
		var num1 = parseInt(document.getElementById('num1').value);
		var num2 = parseInt(document.getElementById('num2').value);
		var result = num1 / num2;
		document.getElementById('result').innerHTML = "Resultado: " + result;
	}
</script>

calculadora's People

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.