Question
Python Programming - Create a program that randomly generates two numbers, then depending on a choice will Add, Subtract, Multiply, or Divide the two numbers.
Python Programming
- Create a program that randomly generates two numbers, then depending on a choice will Add, Subtract, Multiply, or Divide the two numbers.
The program should repeat the entire process until the user decides to quit. At the end display how many times the program repeated and how many correct answers were provided.
How to prevent division by zero generate two numbers if the second number is zero you can add 1 to it for this exercise. NOTE: you can divide into 0, but not by 0, so we are not worried about num1 being a zero.
How to prevent negative subtraction results; IF the second number is larger than the first number: int temp = num1; num1 = num2; num2 = temp;
How to only get whole numbers from division: do Not show problem until you do the next line int newDividend = num1 * num2 now you can use newDividend to divide num 1 into and...of course, the answer is now equal to num2...
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started