Calculatrice en ligne

Une petite calculatrice c'est toujours utile ! Momes vous propose cette petite calculatrice en ligne toute simple, toute basique mais qui saura résoudre n’importe quelle additions, soustractions, divisions haut-la main !

  • à partir de 6 âge
  • CP - classe
calculatrice en ligne

var Memory = 0; var Number1 = ""; var Number2 = ""; var NewNumber = "blank"; var opvalue = ""; function Display(displaynumber) { document.calculator.answer.value = displaynumber; } function MemoryClear() { Memory = 0; document.calculator.mem.value = ""; } function MemoryRecall(answer) { if (NewNumber != "blank") { Number2 += answer; } else { Number1 = answer; } NewNumber = "blank"; Display(answer); } function MemorySubtract(answer) { Memory = Memory - eval(answer); } function MemoryAdd(answer) { Memory = Memory + eval(answer); document.calculator.mem.value = " M "; NewNumber = "blank"; } function ClearCalc() { Number1 = ""; Number2 = ""; NewNumber = "blank"; Display(""); } function Backspace(answer) { answerlength = answer.length; answer = answer.substring(0, answerlength - 1); if (Number2 != "") { Number2 = answer.toString(); Display(Number2); } else { Number1 = answer.toString(); Display(Number1); } } function CECalc() { Number2 = ""; NewNumber = "yes"; Display(""); } function CheckNumber(answer) { if (answer == ".") { Number = document.calculator.answer.value; if (Number.indexOf(".") != -1) { answer = ""; } } if (NewNumber == "yes") { Number2 += answer; Display(Number2); } else { if (NewNumber == "blank") { Number1 = answer; Number2 = ""; NewNumber = "no"; } else { Number1 += answer; } Display(Number1); } } function AddButton(x) { if (x == 1) EqualButton(); if (Number2 != "") { Number1 = parseFloat(Number1) + parseFloat(Number2); } NewNumber = "yes"; opvalue = '+'; Display(Number1); } function SubButton(x) { if (x == 1) EqualButton(); if (Number2 != "") { Number1 = parseFloat(Number1) - parseFloat(Number2); } NewNumber = "yes"; opvalue = '-'; Display(Number1); } function MultButton(x) { if (x == 1) EqualButton(); if (Number2 != "") { Number1 = parseFloat(Number1) * parseFloat(Number2); } NewNumber = "yes"; opvalue = '*'; Display(Number1); } function DivButton(x) { if (x == 1) EqualButton(); if (Number2 != "") { Number1 = parseFloat(Number1) / parseFloat(Number2); } NewNumber = "yes"; opvalue = '/'; Display(Number1); } function SqrtButton() { Number1 = Math.sqrt(Number1); NewNumber = "blank"; Display(Number1); } function PercentButton() { if (NewNumber != "blank") { Number2 *= .01; NewNumber = "blank"; Display(Number2); } } function RecipButton() { Number1 = 1 / Number1; NewNumber = "blank"; Display(Number1); } function NegateButton() { Number1 = parseFloat(-Number1); NewNumber = "no"; Display(Number1); } function EqualButton() { if (opvalue == '+') AddButton(0); if (opvalue == '-') SubButton(0); if (opvalue == '*') MultButton(0); if (opvalue == '/') DivButton(0); Number2 = ""; opvalue = ""; }

MACHINE à CALCULER

Petit bloc-note pour noter les résultats intermédiaires :

À lire aussi

La rédaction de Mômes.net Article mis à jour le