»
AnglaisFran�aisVietnamien

Imprimer - Facteurs - JavaScriptBank.com

Version compl�te: jsB@nk » » Facteurs
URL: https://www.javascriptbank.com/factors.html

Facteurs © JavaScriptBank.comUtiliser JavaScript à find si un nombre entré est impair ou même et de la facteurs de ce nombre.

Version compl�te: jsB@nk » » Facteurs
URL: https://www.javascriptbank.com/factors.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">//Nicholas John Sullivan ([email protected])<!-- Beginfunction calc() {var dnum = ((eval(document.res.inpa.value)) / 2);var i;var pol;var inum = (Math.round(dnum));if (inum == dnum) {document.res.rses.value="Number: " + (eval(document.res.inpa.value)) + " is Even\n\n";}else {document.res.rses.value="Number: " + (eval(document.res.inpa.value)) + " is Odd\n\n";}document.res.rses.value += "Factors Are:\n\n";var num = Math.round(eval(document.res.inpa.value));for (i = 2; i < (num / 2); i++) {var chkd = Math.round(num / i);var inn = Math.round(num / i);var outt = (num / i);if (inn == outt && chkd > i) {document.res.rses.value = document.res.rses.value + "(" + (num/i) + "," + i + ")";      }   }}function numbersonly() {if (event.keyCode < 48 || event.keyCode > 57) return false;}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="res"><input type=text value="0" name="inpa" onkeypress="return numbersonly()"><input type=button name="bt1" value="Calculate" onClick="calc()"><br>Results<br><textarea name="rses" cols="20" rows="10" value="nothing"></textarea></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->