George Posted August 26, 2004 Report Share Posted August 26, 2004 existe alguma forma de identificar se um número é par ou ímpar? Quote Link to comment Share on other sites More sharing options...
0 ricardo Posted August 27, 2004 Report Share Posted August 27, 2004 Em javascript sim...Entre o body<imput name=qualquer type=text onchange=aaa(nome_do_form.qualquer.value)> <div name=div></div>entre as tags heads...<script language=javascript>function aaa(B){###while (b>1000){b -= 1000}while (b>100){b -= 100}###while (b>2){b-= 2}if (b=0){innerhtml.div="par"}else{innerhtml.div="ímpar"}}</script>Cara adoro escrever scripts, mas odeio corrigilos... dei uma ohada rápida e aparentemente está certo, mas não garanto nada... dá para tirar o que está entre os ### e o resultado não muda... mas eu acho que vai demorar mais...Ricardo.editado, por conter erros... Quote Link to comment Share on other sites More sharing options...
Question
George
existe alguma forma de identificar se um número é par ou ímpar?
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.