$(function() { $("#n1").draggable({revert: "invalid", helper:"clone"}); $("#memoria").droppable({activeClass:"#n1", drop:function(event, ui){$("#memoria").html($("#n1").html());}}); $("#memoria").draggable({revert: "invalid", helper:"clone"}); $("#n1").droppable({activeClass:"#memoria", drop:function(event, ui){$("#n1").html($("#memoria").html());}}); $("#n1").on("click", function(){ $("#n1").html("");} ); $("#cuadrado").on("click", function() { var num = $("#n1"); num.html(num.html() * num.html());} ); $("#inverso").on("click", function() { var num = $("#n1"); num.html(1 / num.html());} ); $("#raiz").on("click", function() { var num = $("#n1"); num.html(Math.sqrt(num.html()));} ); $("#entero").on("click", function() { var num = $("#n1"); if (num.html() > 0) { num.html(Math.floor (num.html()));} else {num.html(-Math.ceil (num.html()));}; } ); $("#potdos").on("click", function() { var num = $("#n1"); num.html(Math.pow(2, +num.html()));} ); $("#factorial").on("click", function() { var num = $("#n1"); var numero = +num.html() var factorial = 1; while ( numero!=0) { factorial = factorial * numero; numero--; }; num.html(factorial);} ); $("#mas").on("click", function() { var num = $("#n1"); acc = num.html(); op = "+";} ); $("#menos").on("click", function() { var num = $("#n1"); acc = num.html(); op = "-";} ); $("#multiplicar").on("click", function() { var num = $("#n1"); acc = num.html(); op = "*";} ); $("#dividir").on("click", function() { var num = $("#n1"); acc = num.html(); op = ":";} ); $("#potencia").on("click", function() { var num = $("#n1"); acc = num.html(); op = "x^y";} ); $("#calcular").on("click", function() { var num = $("#n1"); if (op === "+") {num.html(+acc + +num.html());}; if (op === "-") {num.html(+acc - +num.html());}; if (op === "*") {num.html(+acc * +num.html());}; if (op === ":") {num.html(+acc / +num.html());}; if (op === "x^y") {num.html(Math.pow (+acc, +num.html()));}; } ); $("#sumatorio").on("click", function() { var num = $("#n1"); var lista = num.html().split(","); for (var i=0, acc=0; i

Welcome to my Website!