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
Computer security:
Monica [59]

Answer:

A) Direct

Explanation:

if u want to be very specific on what u need to get into then u need to be direct on what u are getting into.

7 0
3 years ago
What is the purpose of the backoff on Ethernet networks?
stellarik [79]

Answer: Please see below as the answer is self-explanatory.

Explanation:

In the original Ethernet standard, IEEE 802.3, the method used to deliver packets within a Ethernet network, is called CSMA/CD, and the acronym includes all the Ethernet features in brief.

Let's explain the different parts of the acronym.

CSMA= Carrier Sense Multiple Access.

This means that when any computer in the network (with no privileges for nobody) has a packet to transmit, it first "listen"if the network is idle. If it is the found condition, deliver the packet, and wait for an acknowledgement.

If past a given time, the ACK is not received, assumes that the packet was lost, due to a collision with another packet coming from another computer (this can happen because the packets don't travel instantaneously from one host to another, so one machine could have started to transmit before the another one could sense this fact).

This process is described by the other part of the acronym:

CD = Collission Detection

In order to avoid this type of problem, before trying to resend the packet, it waits some time, which is called "backoff".

This time increases exponentially each time that it is not possible to send a packet successfully, in order to try to find a moment in which finally the network be clear.

8 0
4 years ago
What if you put a flashdrive in a iphone block and plug it in an outlet
Rzqust [24]
Nothing will happen since there is no data transfer it will just sit there
7 0
3 years ago
Read 2 more answers
ANSWER QUICKLIY
lidiya [134]

Answer:

Explanation:

Allow you to view the document in different ways. Sorry if I am wrong. I am dumb

God bless, stay safe, and good luck! :)

4 0
3 years ago
Read 2 more answers
Each three-digit number in an IP address is a(n) _____.
goldenfox [79]
B kidssssssssssssssssssssssss
3 0
4 years ago
Other questions:
  • You want to transfer a document from one computer to another, and you want the document to be encrypted. The destination compute
    14·1 answer
  • Blood alcohol level is the ratio between the alcohol consumed and the blood in the body
    10·1 answer
  • A critical path refers to:
    15·1 answer
  • When paying bills online, a payee is:
    9·1 answer
  • In one to three sentences describe one reason you would import data into a datebase
    13·1 answer
  • _____ can analyze the content of social media communications within the context of a specific brand or product and determine wha
    13·1 answer
  • The Internet raises the bargaining power of customers most effectively by: making information available to everyone. reducing ba
    15·1 answer
  • Pls answer i will give 20 points
    7·1 answer
  • When formulating a linear programming model on a spreadsheet, the decisions to be made are located in the data cells.
    13·1 answer
  • A Social agency hires Accenture to improve training and experiences for caseworkers. What is one way Accenture can use Virtual R
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!