Question

Write a C sharp program capable of this quiz: Welcome to The Quiz Program! You can...

Write a C sharp program capable of this quiz:

Welcome to The Quiz Program!
You can be quizzed on any of the following operators:
1) % (modulus, or 'remainder')
2) * (multiplication)
3) / (integer division)
4) / % (integer division & modulus in a combined challenge!
Type the number of the operator that you wish to be quizzed on: 1

I will ask you to tell me the result of

     A % B

What is the smallest value of A: 0
What is the largest value of A: 100
What is the smallest value of B: 40
What is the largest value of B: 50

How many times do you wish to be quizzed:
3

Ok, we're ready to go!
What is the result of 92 % 44?   4
4 is correct!
What is the result of 92 % 48?   4
Good try, but no: 92 % 48 = 44
What is the result of 18 % 47?   47
Good try, but no: 18 % 47 = 18
Thank you for using this program - have a nice day!

Press the 'Return' key to exit

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Output will be like:

Code will be like:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QuizzedOnConsole
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome to The Quiz Program!"+
"You can be quizzed on any of the following operators:"+
"1) % (modulus, or 'remainder')"+
"2) * (multiplication)"+
"3) / (integer division)"+
"4) / % (integer division & modulus in a combined challenge!)");

Console.WriteLine("Type the number of the operator that you wish to be quizzed on");
string response = Console.ReadLine();
Console.WriteLine("How many times do you wish to be quizzed:");
int count = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Ok, we're ready to go!");

switch(response)
{
case "%":


for (int i = 0; i < count; i++)
{


Random rnd1 = new Random();
int val1 = rnd1.Next(0, 5);

Random rnd2 = new Random();
int val2 = rnd2.Next(6, 10);
Console.WriteLine("What is the result of " + val1 + "and " + val2);
double ans = Convert.ToDouble(Console.ReadLine());
if (val1 % val2 == ans)
{
Console.WriteLine(ans + " is correct");

}
else
{
Console.WriteLine("Good try but no: " + val1 + "%" + val2 + " is " + val1 % val2);
}
}

Console.WriteLine("Thank you for using this program - have a nice day!");

break;

case "*":


for (int i = 0; i < count; i++)
{


Random rnd1 = new Random();
int val1 = rnd1.Next(0, 5);

Random rnd2 = new Random();
int val2 = rnd2.Next(6, 10);
Console.WriteLine("What is the result of " + val1 + "and " + val2);
double ans = Convert.ToDouble(Console.ReadLine());
if (val1 * val2 == ans)
{
Console.WriteLine(ans + " is correct");

}
else
{
Console.WriteLine("Good try but no: " + val1 + "*" + val2 + " is " + val1 * val2);
}
}

Console.WriteLine("Thank you for using this program - have a nice day!");

break;

case "/":


for (int i = 0; i < count; i++)
{


Random rnd1 = new Random();
int val1 = rnd1.Next(0, 10);

Random rnd2 = new Random();
int val2 = rnd2.Next(0, 10);
Console.WriteLine("What is the result of " + val1 + "and " + val2);
double ans = Convert.ToDouble(Console.ReadLine());
if (val1 / val2 == ans)
{
Console.WriteLine(ans + " is correct");

}
else
{
Console.WriteLine("Good try but no: " + val1 + "/" + val2 + " is " + val1 / val2);
}
}

Console.WriteLine("Thank you for using this program - have a nice day!");

break;


}
Console.ReadLine();
}
}
}

Please rate it if the above solution helps you in any way or if you have any concerns comment it, I will help you through again.

Add a comment
Know the answer?
Add Answer to:
Write a C sharp program capable of this quiz: Welcome to The Quiz Program! You can...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT