1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
GrogVix [38]
3 years ago
12

Write a program that outputs a subtraction practice problem for a student, outputting the larger random number

Computers and Technology
1 answer:
PolarNik [594]3 years ago
5 0

Answer:

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

int main(void)

{

   srand(time(NULL));

   int num1, num2;

   int val;

   while (true)

   {

       num1 = rand() % 100 + 1; //Random number between 1-100

       num2 = rand() % 100 + 1; //Random number between 1-100

       if (num1 >= num2)

       {

           printf("%d - %d = ", num1, num2);

           scanf("%d",&val);

           if (val == num1-num2)

           {

               printf("Correct!\n");

           }

           else

           {

               printf("Incorrect!\n");

           }    

       }

       else

       {

           printf("%d - %d = ", num2, num1);

           scanf("%d",&val);

           if (val == num2-num1)

           {

               printf("Correct!\n");

           }

           else

           {

               printf("Incorrect!\n");

           }

       }    

   }

}

Explanation:

First, we create two random numbers and save the values.  Then we check to see which value is larger.  Based on that, we change how we display the format to the user.  Then we check to see if the user input number is equivalent to the subtraction problem.  If it is, we display Correct!  Else, we display Incorrect!

Cheers.

You might be interested in
Which of the following best explains how algorithms that run on a computer can be used to solve problems?
timama [110]

The statement which best explains how algorithms running on a computer can be used to solve problems is; D. Some problems cannot be solved by an algorithm.

<h3>What is an algorithm?</h3>

An algorithm is simply a standard formula or procedures which is made up of a set of finite steps and instructions that must be executed on a computer, so as to proffer solutions to a problem or solve a problem under appropriate conditions.

However, it should be noted that it is not all problems that can be solved by an algorithm, especially because the required parameters and appropriate conditions are not feasible or met.

Read more on algorithm here: brainly.com/question/24793921

7 0
2 years ago
When programming, the word "execute" means which of these?
Inga [223]

Answer:

to run!

Explanation:

hope this is helpful!

7 0
3 years ago
One of the newest electronic conveniences is the ________, which can serve as a credit card, a debit card, and even unlock doors
77julia77 [94]
Computer Chips. / SILICON. This is just an educated guess
7 0
3 years ago
The development team recently moved a new application into production for the accounting department. After this occurred, the Ch
Gnesinka [82]

Answer:

B

Explanation:

User Acceptance Testing (UAT) is the testing done by end users who is going to use that application. In these testing they will test  whether the application meets all the functional requirements of the end user. If it passed then only the application will move to the production. This will ensure that the application meets the user requirements before it put into the usage.

The Answer is B

5 0
3 years ago
What is the newest iphone?
OlgaM077 [116]

xR max is the newest iPhone out right now

7 0
3 years ago
Read 2 more answers
Other questions:
  • 4. What aspect of the initial database planning process would the formula (0 + Pt × 3 + p)/5 be used in?
    5·1 answer
  • Create a public non-final class named Streamer. You should implement one class method: filterStrings. It should accept a single
    8·1 answer
  • Suppose that a computer virus infects your computer and corrupts the files you were going to submit for your current homework as
    12·1 answer
  • Technician A says that the push rod connects to a pivoting component mounted at the top of the cylinder head called the camshaft
    14·2 answers
  • . Constructors can / cannot (circle correct choice) be called explicitly as if they were regular member functions.
    10·1 answer
  • What does t'challa actions reveal about his character( black panther movie)​
    6·1 answer
  • Deleting anitem from a linked list is best when performed using two pointersso that the deleted item is freed from memory.
    7·1 answer
  • Recall that in C++ there is no check on an array index out of bounds. However, during program execution, an array index out of b
    9·1 answer
  • Can somebody tell me the Minecraft command to clear an entire world and destroy every block if u Dunno please don’t answer &gt;-
    13·1 answer
  • PLEASE PLEASE PLEASE PLEASE help me Im completly lost will give brainliest and 50 points
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!