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
Name the type of software which provides the user interface. [1 mark
Inessa [10]

Explanation:

user interface, also sometimes called a human-computer interface, comprises both hardware and software components. It handles the interaction between the user and the system.

There are different ways of interacting with computer systems which have evolved over the years. There are five main types of user interface:

command line (cli)

graphical user interface (GUI)

menu driven (mdi)

form based (fbi)

natural language (nli)

7 0
3 years ago
What is the address of the first SFR (I/O Register)​
amid [387]

Answer:

The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF.

Explanation:

The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF.

Reason -

A Special Function Register (or Special Purpose Register, or simply Special Register) is a register within a microprocessor, which controls or monitors various aspects of the microprocessor's function.

4 0
3 years ago
List the names of 3 computer scientists
ikadub [295]

Hi there! Hopefully this helps!

------------------------------------------------------------------------------------------------------

1. Barbara Liskov.

2. Carl Sassenrath.

3. Larry Page.

4 0
3 years ago
Read 2 more answers
Which technology can be used to protect the privacy rights of individuals and simultaneously allow organizations to analyze data
iren [92.7K]

Answer:

De-identification or data anonymization.

Explanation:

Privacy rights are fundamental right of individuals to privatise all personal information, when creating an account.

The de-identification and data anonymization technology is provided by the organisation to user, to prevent their information to be viewed by others. It commonly used in cloud computing, communication, internet, multimedia etc. Reidentification is the reversing of the de-identification effect on personal data.

4 0
4 years ago
What would best describe the future of cybersecurity?
Andrei [34K]

The best describe the future of cybersecurity is strong security policies offer little protection.

<h3>What is cybersecurity?</h3>

Cybersecurity is the security of data or computer systems. Cybersecurity is provided from the hackers that hacks the data and money online.

As everything is converting digital, the need of cybersecurity is increasing.

Thus, the correct option is B.

Learn more about cybersecurity

brainly.com/question/27560386

#SPJ1

5 0
2 years ago
Other questions:
  • The design activity key question, "how will this system interact with other systems..." is part of which design activity?​
    7·1 answer
  • What element of a timeline helps to mark progress of the project?
    15·1 answer
  • Which function is going to find the lowest value in a range of numbers? MIN MAXAVERAGE COUNT
    5·1 answer
  • Li Chang has recently started his own business. He plans to launch his design for an application (app) for a smartphone. All of
    9·1 answer
  • What are 6 steps to take to figure out what's wrong with your computer?
    5·1 answer
  • Which of the following is the correct financial function that returns the periodic payment for a loan?
    10·1 answer
  • How can having more than one goal cause truble in the work place
    6·1 answer
  • What do we do if IOC is called on the intercom ??
    14·1 answer
  • Which TWO objects are likely to have SSD chips in them?
    5·2 answers
  • A.1111+1011. b. 10111+11111 c. 1111*1011 d. 1110*1101 perform the binary calculations.​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!