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
Which of the following is a valid format symbol in Microsoft Excel? Dollar Sign, Comma, Percent Sign or all of them? I can't fig
Helen [10]
The Answer is all of them, it's okay when i had to take this class last year and it took me for ever to find the tab and paste options. 
6 0
2 years ago
A company wants to build a new type of spaceship for transporting astronauts to the moon. What should the company do first?
Paraphin [41]

Answer:

Think of some ideas of how their gonna create the new spaceship

Explanation:

Because I'm Smort (typo intended)

4 0
3 years ago
Read 2 more answers
An application programming interface (API) is ________. Select one: A. the code to interface between an application and RAM B. t
Olegator [25]

Answer:

An application programming interface (API) is the code the CPU recognizes to perform a procedure in an application.

Explanation:

An application programming interface (API) is the code the CPU recognizes to perform a procedure in an application. API allows an application to communicate with another application, or an operating system, database, network, etc.

An Application Programming Interface (API) creates a consideration for a problem and specifies how clients should interact with software components that implement a solution to that problem.

More recently, API has been used to refer to a specific type of interface between a client and a server, which has been described as a “contract” between both - such that if the client makes a request in a specific format, it will always get a response in a specific format or initiate a defined action.This is a specialized form of API, defined as a Web API.

3 0
2 years ago
George is only familiar with VGA connector for monitors. What should you tell him are the main differences between VGA and DVI c
lara [203]

Answer:

That a DVI connector looks different and that it support more monitors.

Explanation:

3 0
3 years ago
Employees at the Red Bluff Golf Club &amp; Pro Shop have the opportunity to become certified trainers if they log enough hours.
vodka [1.7K]

Answer:

Following are the solution to this question:

Explanation:

Some of the data is missing in the question, which is defined in the attached file. Please find it.

Follows are the formula which is used in the question:

  • EmployeeAnalysis Worksheet IF(C5>49,"Certified","Not Certified")
  • Transactions Worksheet IF(F10="No","",0.07)

In the first condition, it checks "C5" is greater than 49 if the condition is true, it will give "Certified" otherwise, it will give "Not Certified".

In the second condition, it checks "F10" is equal to "No" if the condition is true, it will give a blank or space otherwise, it will give "0.07".

3 0
2 years ago
Other questions:
  • Why has unicode become the standard way of converting binary to text??
    8·1 answer
  • What's a good show to watch on Netflix?
    7·1 answer
  • When is Hytale coming out?<br><br><br> P.S it might be Mine-craft 2.0<br><br><br> :)
    7·1 answer
  • you have a small network in your business with just a few network devices connected along with 22 linux computers and you want t
    7·1 answer
  • Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that dea
    12·1 answer
  • Scenario
    7·1 answer
  • Define the instance method inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids. Sample output for th
    6·1 answer
  • The cameras picture review function allows you to look at the _ you've taken
    8·1 answer
  • Is spin to win paying or is a scam app​
    6·2 answers
  • Say true or false
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!