Giter Site home page Giter Site logo

calculadora's Introduction

Calculadora

<title>Calculadora</title> <style> *{ margin: 0; padding: 0; } .fundo{ background-image: linear-gradient(45deg, black, rgb(164, 201, 158)); height: 100vh; color:azure; font-family: Arial, Helvetica, sans-serif;
    }
    .calculadora{
        position:absolute;
        background-color:black;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-50%);
        border-radius: 15px;
        padding: 15px;
    }

    .botão{
        width: 50px;
        height: 50px;
        font-size: 25px;
        cursor: pointer;
        
    }
    .botão{
        background-color:whitesmoke;
        margin: 3px;
        
    }
    #resultado{
        background-color:white;
        width: 207px;
        height: 30px;
        margin: 5px;
        font-size: 25px;
        color: black;
        text-align: right;
        padding: 5px;



    }

</style>
    <h1> Oi.. gente :)   sou  o Laurindo Dumba aluno da STACKX</h1>

    <div class = "calculadora">
        <h1>Calculadora</h1>

        <p id = "resultado"></p>

        <table>
            <tr>
                <td><button class="botão" onclick = "clean()">C</button></td>
                <td><button class="botão" onclick = "back()"><</button></td>
                <td><button class="botão" onclick = "insert('/')">/</button></td>
                <td><button class="botão" onclick = "insert('x')">x</button></td>
            </tr>

            <tr>
                <td><button class="botão" onclick = "insert('7')">7</button></td>
                <td><button class="botão" onclick = "insert('8')" >8</button></td>
                <td><button class="botão" onclick = "insert('9')">9</button></td>
                <td><button class="botão" onclick = "insert('-')">-</button></td>
            </tr>

            <tr>
                <td><button class="botão" onclick = "insert('4')">4</button></td>
                <td><button class="botão" onclick = "insert('5')">5</button></td>
                <td><button class="botão" onclick = "insert('6')">6</button></td>
                <td><button class="botão" onclick = "insert('+')">+</button></td>

            </tr>

            <tr>
                <td><button class="botão" onclick = "insert('1')">1</button></td>
                <td><button class="botão" onclick = "insert('2')">2</button></td>
                <td><button class="botão" onclick = "insert('3')">3</button></td>
                <td rowspan="2"><button class="botão"style="height:106px;" onclick = "calcular()">=</button></td>
            </tr>

            <tr>
                <td colspan = "2"><button class="botão" style="width:106px;" onclick = "insert('0')">0</button></td>
                <td><button class="botão" onclik = "insert('.')">.</button></td>
            </tr>

        </table>

    </div>
</div>
<script>
    function insert(num)
        {
            var numero = document.getElementById('resultado').innerHTML;
            document.getElementById('resultado').innerHTML = numero + num;

        }
        function clean()
        {
            document.getElementById('resultado').innerHTML = "";
        }
        function back()
        {
            var resultado = document.getElementById('resultado').innerHTML;
            document.getElementById('resultado').innerHTML = resultado.subtring(0, resultado.length, -1);
        }
        function calcular()
        {
            var resultado = document.getElementById('resultado').innerHTML;
            if(resultado)
            {
                document.getElementById('resultado').innerHTML = eval(resultado);
            }
            else
            {
                document.getElementById('resultado').innerHTML = "Nada....";
            }
        }
</script>

calculadora's People

Contributors

laurindodumba 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.