logo
Ryan's Webpage
 

Pseudocode & Program

1. Declare variables: firstNum, secondNum, total, and guess

2. Start for loop(5 times)

3. Make 2 random #'s between 1-100

4. Add the 2 random #'s

5. Start the while loop

6. Prompt

7. End while loop

8. End for loop

<html>
<body>
<script>
// by Ryan Te
// 10/11/07
// excercise 3

var firstNum = "0";
var secondNum = "0";
var total = "0";
var guess = "0";
var i = "0";

alert("This is a 5 questions math test");

for (i = 0; i < 20; i += 4)

{
firstNum = Math.floor(Math.random()*100) + 1;
secondNum = Math.floor(Math.random()*100) +1;
total = firstNum * secondNum;
while(total != guess)
{
guess = prompt("What is " + firstNum + "x" + secondNum + "?");

if(total != guess)
{
alert("Sorry, try again")
} // end
} // end
} // end

alert("Thanks you, you've finished the quiz sucessfully");
</script>
</body>
</html>

 

Contact Me

 

Mr. Styner's Webpage

 

Peter

Julie

Nick

Tiddus

Norman