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
Easy Bib and Cite This For Me are examples of online
motikmotik
The answer is:  [A]:  "bibliographic generators" .
____________________________________________________
5 0
3 years ago
What’s unique about New Cashierless stores?
Anettt [7]
There’s no cashiers, meaning if you need help you got to figure it out alone.
7 0
2 years ago
What are the value and data type (float, int, bool, or str) of this expression:<br><br> 5 % 2
amm1812

Answer: float

Explanation:

This is asking what would the remainder be of 5/2. I am not totally sure what you are asking but float is used with remainders because it could have a decimal like 3.33 that would throw an error for anything other than float.

3 0
2 years ago
What is the proper way to name the range of cells located in colum A row 3 through colum C row 7?
LenKa [72]

Answer:

it is C

Explanation:

6 0
3 years ago
Read 2 more answers
What variable can be changed when using the WEEKDAY function
gregori [183]

Answer:

This brainly page should be able to help, make sure to thank them if it's correct

<em><u>brainly.com/question/15076370</u></em>

<em><u /></em>

3 0
3 years ago
Other questions:
  • Write a static method, getBigWords, that gets a single String parameter and returns an array whose elements are the words in the
    15·1 answer
  • can any one tell me the difference between the things showed in the circle i will mark brainiest to the first one
    11·1 answer
  • Search engine ranking evaluates the variables that search engines use to determine where a URL appears on the list of search res
    7·1 answer
  • Universal Containers has a requirement to integrate Salesforce with an external system to control record access. What option sho
    11·1 answer
  • As a ______________ you must be able to show that you know what to do to keep food safe
    15·1 answer
  • You have repaired a broken LCD panel in a laptop computer. However, when you disabled the laptop, you bent the hinge on the lid
    15·1 answer
  • The _______ "represents a set of features that enables the user to inform himself whether a security feature is in operation or
    8·1 answer
  • Maeve has created the website, but she is not able to include more than one blank space at a time. Even if she hits the SPACE bu
    6·1 answer
  • A different way of pronoucing the same words is called a _____
    15·1 answer
  • ¿que lenguaje de programacion usan los operadores matematicos?​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!