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]
2 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]2 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
You are configuring a firewall to use NAT. In the configuration, you map a private IP address directly to a persistent public IP
Ivan

Answer:

Option B (Static NAT) would be the correct choice.

Explanation:

  • Static NAT seems to be a method of NAT methodology used to navigate as well as monitor internet usage from some kind of specific public IP address to something like a private IP address.
  • Everything always allows the provision of web access to technology, repositories including network equipment inside a protected LAN with an unauthorized IP address.

Some other decisions made aren't relevant to the situation in question. So the above alternative is indeed the right one.

8 0
3 years ago
Which of the following is true about a hot site?
swat32

Answer:

Option(d) is the correct answer to the given question.

Explanation:

A hot site is a place off site in which the task of a corporation could restart during a massive failure.The hot site seems to have all the needed equipment for such the corporation to schedule the normal activities, such as phone jacks, replacement data, laptops, and linked devices.

  • The main objective of hot sites provide an useful backup mechanism for any corporation that wishes to pursue its business in the presence of exceptional circumstances or events.
  • All the others options are not related to hot site that's why they are incorrect option.
8 0
3 years ago
Which of these has an onboard key generator and key storage facility, as well as accelerated symmetric and asymmetric encryption
Darya [45]

Answer:

Hardware security module.

Explanation:

Hardware security module is a Physical digital device that comes as a plug-in adapter used to secure and manage digital keys and provides crypto processing for strong authentication.

It has an onboard cryptographic keyboard and one or more crypto processors, and can be used on computers and network servers to prevent logical or physical authentication access to unauthorized users. It supports symmetric and asymmetric cryptography.

8 0
3 years ago
Why doesn't the ad load ?
baherus [9]
Try refreshing the page, if not restart your device check your internet etc.
3 0
2 years ago
Read 2 more answers
Suppose as a computer programmer, you have been assigned a task to develop a program to store the sorted data in ascending order
patriot [66]

Answer: i dont know but have an great day

Explanation:

5 0
3 years ago
Other questions:
  • Describe the indicators and hazards of a metal deck roof fire in an unprotected steel joist warehouse as well as the techniques
    6·1 answer
  • DJ wants to see how his document will look when printed. Where would he find the button to see the document in print view? the P
    5·2 answers
  • You are entering command that operates on a file. The path to the file is lengthy and confusing and you are afraid that you will
    12·1 answer
  • Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
    15·1 answer
  • You are responsible for performing all routine maintenance on your company's laser printers. Which of the following maintenance
    15·1 answer
  • Why does brainly keep saying “oops... something went wrong! Try again”
    7·2 answers
  • What is a file type and why is it important? Give at least three examples of file
    7·1 answer
  • Teniendo en cuenta la realidad mundial acerca de la pandemia, ¿cómo crees que impacta
    9·1 answer
  • Please please help I don’t understand this please.
    11·1 answer
  • Rewrite the code below so that a transformation moves the div 100px to the right and 50px upward.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!