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
A ________ topology uses more than one type of topology when building a network. crossover multiple-use fusion hybrid
frosja888 [35]

Answer:

hybrid topology

Explanation:

The type of topology that is being described is known as a hybrid topology. Like mentioned in the question this is an integration of two or more different topologies to form a resultant topology which would share the many advantages and disadvantages of all the underlying basic topologies that it is made up of. This can be seen illustrated by the picture attached below.

6 0
3 years ago
When a workforce scheduling problems is formulated as an integer programming model, it has:?
Dennis_Churaev [7]
More force because it's the impact
6 0
3 years ago
Online dictionaries are a type of​
kap26 [50]

Answer:

learning tool. i may be wrong

Explanation:

8 0
3 years ago
Consider the clipping of a line segment in two dimensions against a rectangular clipping window. Show that you require only the
Semmy [17]

Answer / Explanation:

Assuming we define the end points as ( x₁ , y₁) and (x₂ , y₂) and the rectangular window edge as ( Xmin ,Ymin and Xmax , Ymax)

The illustration of the above assumption is represented in the diagram below.

Now, suppose the line segment is between the points P₁ = ( x₁ , y₁) , and

P₂ = (x₂ , y₂).

We can then create a line recalling and using parametric form,

P(t) = ( 1 - t) P₁ + tP₂ , t ∈ {0 , 1 },

So, for the X axis, we have,

tₓ = P₁ₓ - x ÷ P₁ₓ - P₂ₓ

We need to note that at this point we need to know the minimum and maximum unclipped  values for parameter t from each dimension.

Therefore,

- ( tmin , tmax ) = ( 0,1) means unclipped line

-tmin > tmax means completely clipped out line

– Some other range means partially clipped out line.

6 0
3 years ago
Renee's creating a plan for her business's information system. What should she do after she determines the goals for her busines
stiks02 [169]

get organized because of the beging when she start she will want ot be nice and fresh on everything

7 0
4 years ago
Other questions:
  • Describe how you center text.
    7·2 answers
  • The type of database that uses fields, records, and measure as data attributes is
    7·1 answer
  • What is the basic difference between a printer and a plotter?​
    12·1 answer
  • What are the three types of programming design?
    15·1 answer
  • Discuss some design considerations that you should keep in mind when you want to design a professional-looking flyer or newslett
    12·1 answer
  • What is the traditional cognitive perspective ofHCL?
    12·1 answer
  • How Can I add a image in an HTML program?​ please tell
    6·1 answer
  • What will the declaration below do to its target?
    9·1 answer
  • wants to redesign the user interface. The customer service agents use ________ to enter explicit statement to invoke operations
    11·1 answer
  • Hello my name is Phoenix I will like for you to friend me on Ro blox my user name is Jessiahcoleman and if u play BLOX fruits or
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!