63.8k views
1 vote
Currently, this program will add 6 and 3 together, output the math problem and output the answer. Edit this code so that a random number is generated from 1 - 10 (inclusive) for the variables a and b. Also, instead of adding the two numbers together, the edited program should multiply them, and output the proper math problem and answer. Be sure to update every line of code to reflect the changes needed.

2 Answers

6 votes

Answer:

Did you end up getting it right ? I am currently doing it but I am confused

Step-by-step explanation:

User Simon Schubert
by
6.1k points
3 votes

Answer:

Step-by-step explanation:

This depends on the language. Most random number generators are from 0 to 1 so that when you go from 1 to 10 inclusive, your generator will look something like

x := int(rand(10) + 1;

y will look the same way

y := int(rand(10) + 1

Now you need to multiply them together.

Sum := x * y;

And now you need to give the results of what the computer has done.

My language uses labels so it would look like this.

label1.caption := inttostr(x) + ' times '+inttostr(y) + ' = ' + inttostr(sum);

User Trivikram
by
6.3k points