PDA

View Full Version : Simple Coding Help



McLeroy
Mar 23rd, 2007, 01:39 AM
Hey guys, i'm new to java script and i'm trying to figure out how to do this. I'm having trouble with creating a program that prompts a user to provide you with two numbers. Then divide the larger number by the smaller number and return the modulo.

Can someone help please?

1212jtraceur
Mar 23rd, 2007, 04:23 AM
Do a little research: try googling 'javascript prompt' and 'javascript modulo'.

brandonH
Mar 23rd, 2007, 05:19 AM
<script type=text/javascript>
function doit(){
var numb1=prompt("put in first number",'0');
var numb2=prompt("put in second number",'0');
alert(numb1/numb2);
}

</script>
<input type=button value=start onclick=doit()?

the above does 2 prompts for the 2 numbers, then devideds the first by the second. as far as returning the modulo, you may need to specify exactly wat you want