Question: Hello I need some help with my program. Create a program in C# that will assist a user in learning multiplication. Use a random object
Hello I need some help with my program.
Create a program in C# that will assist a user in learning multiplication. Use a random object to produce two positive one-digit integers. The program should then prompt the user with a question, such as
How much is 6 times 7?
The student then inputs the answer. Next, the pgoram checks the student's asnwer. If it's correct, display the message "Very Good!" and ask another question. If the answer is wrong, display the message "No. please try again." and let the student try the same question repeadedly until the student gets it right. A separate function should be used to generate each new question. This function should be called once the app begins execution and each tiem the user answers the question correctly.
Please take a look at what I currently have and assist me if you see anything wrong. So far I can't get it to display the Very Good part. I also need help to do the function
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Multiplication1 { class Program { static void Main(string[] args) { int value = 1;
while (true) { if (value == -1) { break; } else { Random randomNumbers = new Random(); // random number generator int num01 = randomNumbers.Next(1, 11); int num02 = randomNumbers.Next(1, 11); Console.Write("Please enter the answer to {0} x {1} = ?", num01, num02); int product = num01 * num02; int answer = Convert.ToInt32(Console.ReadLine()); if (product==answer) {
Console.Write("Correct. Your answer was {0} {1} x {2} = {3} {4}", answer, num01, num02, product); //keep console open Console.WriteLine(); Console.WriteLine("Press - 1 to exit or 1 to continue"); value = Convert.ToInt32(Console.ReadLine()); } else { while (product != answer) {
Console.WriteLine("No. Please try again."); Console.WriteLine(); answer=Convert.ToInt32(Console.ReadLine()); } } } } } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
