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
Allisa [31]
3 years ago
10

NOTE: in mathematics, division by zero is undefined. So, in C , division by zero is always an error. Given a int variable named

callsReceived and another int variable named operatorsOnCall, write the necessary code to read values into callsReceived and operatorsOnCall and print out the number of calls received per operator (integer division with truncation will do). HOWEVER: if any value read in is not valid input, just print the message "INVALID". Valid input for operatorsOnCall is any value greater than 0. Valid input for callsReceived is any value greater than or equal to 0.
Computers and Technology
1 answer:
Sergio [31]3 years ago
8 0

Answer:

#include <stdio.h>

int main()

{

   int callsReceived, operatorsOnCall;

   scanf("%d", &callsReceived);

   scanf("%d", &operatorsOnCall);

if(callsReceived>=0 && operatorsOnCall>0)

{

   printf("%d",callsReceived/operatorsOnCall);

}

else

{

   printf("INVALID") ;

} }

Explanation:

The programming language to use here is C.

There is an int type variable named callsReceived    

Another int type variable is operatorsOnCall

scanf is used to read values into callsReceived and operatorsOnCall

printf is used to print the number of calls received per operator which is found by dividing the calls received with the operators on call i.e. callsReceived / operatorsOnCall

Here the callsReceived is the numerator and should be greater than or equal 0 and operatorsOnCall is the denominator and should be less than 0. So an IF condition is used to check if the value stored in operatorsOnCall is greater than 0 and if the value stored in callsReceived is greater than or equal to 0 in order to precede with the division. AND (&&) logical operator is used to confirm that both these conditions should  hold for the IF statement to evaluate to TRUE.

In case the input is not valid, the else part is displayed which means that the message INVALID will be displayed.

In C++ cin is used to read from callsReceived and operatorsOnCall and cout is used to display the results of division or the INVALID message in case the IF condition is false. Rest of the code is the same.

cin >> callsReceived;

cin >> operationsOnCall;

if(callsReceived>=0 && operatorsOnCall>0)

   cout << (callsReceived/operationsOnCall);

else

   cout << "INVALID";

You might be interested in
When describing memory, ____________ is the first component required in the process necessary for retention?
8_murik_8 [283]
Depends on how deep you're willing to go to really,
You need one of a few arrangements of flip flop circuits to keep 1-bit state.
Going deeper, you need either NAND, or NOR gates(or a bunch of other ones) and connectors.
Even deeper, you'll require diodes or transistors to build the logic gates.
Beyond that is particle physics.
8 0
3 years ago
An alarm clock draws 0.5 A of current when connected to a 120 volt circuit. Calculate its resistance.
mixas84 [53]

Answer:

120 vpm

Explanation:

8 0
2 years ago
When creating an electronic slide presentation, Lee should avoid
Amanda [17]

I believe the answer is <u>Using sound effects between slides.</u>

Using sound effects between slides can cause for a distraction, and if you are in college, your professor may not score your presentation as well as if it were made without sound effects. Hope this helps!

5 0
2 years ago
All it services and servers are equally critical. <br> a. True <br> b. False
g100num [7]

False

Not all IT services are equally critical. In an increasingly digital world whereby cyber threats are a big threat, it is vital to prioritize the critical assets in order to achieve digital resilience. This involves building tighter defenses in systems that are critical.

4 0
3 years ago
Which statement opens a text file so that you can retrieve the information it contains?
vesna_86 [32]

Answer:

Answered below

Explanation:

aFile = open("books.txt", "r")

This code uses the function open() which takes two parameters. The first parameter is the file name while the second parameter is the mode in which you are accessing the file.

The "r" mode opens the file in a reading state. That is, you can only read from the file. This code completes the reading process

aFile.read( )

The "w" mode opens the file so you can write to it and make changes.

The "a" mode opens the file so you can add contents to it.

3 0
2 years ago
Other questions:
  • Which statement about trees is false?
    12·1 answer
  • How does the mantle interact with the tectonic plates at a convergent boundary?
    14·2 answers
  • The_provides access to the internet may also be internal​
    9·1 answer
  • Write a program in python that ask the user to enter a word and then capitalizes every other letter of that word
    15·1 answer
  • To combat piracy, many software publishers require users to type in a(n) ____ code, a sequence of numbers and letters in order t
    10·1 answer
  • Which statements accurately describe the Bookmark feature in the Audio/Video control bar? Check all that apply.
    13·1 answer
  • What is output?
    13·1 answer
  • The quickest way to change a word is to double
    11·1 answer
  • To speed up data retrieval, more vehicles will be upgraded to cellular connections and be able to transmit data to the ETL proce
    9·1 answer
  • Why does python code generate fewer types of syntax errors than code in other programming languages?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!