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
Jeremy wishes to create a site map for his website. What tag will surround the URL of his home page?
Inga [223]

Answer:

C. <loc>

Explanation:

We need to mention the below details:

  • location
  • changed frequency
  • last changed
  • priority of page

We have the XML file for a sitemap, and we need to enter the above details for each of the Url. We need to enter the location, last changed, changed frequency and priority of the page for each of the URLs. And the URL of the home page is surrounded by the Loc tag. And hence, the correct option for this post is the C.<Loc> option.

8 0
3 years ago
What is the best way to pay for college?
Virty [35]

Answer:

I think it would be Federal student loans if I am sure sorry if you get it wrong.

Explanation:

3 0
3 years ago
Read 2 more answers
How to bypass a Lightspeed and Rocket Filter blocked website without being a admin and without downloading extensions? Must incl
AVprozaik [17]

You really cant without being admin. Calm yaself child

6 0
3 years ago
What is computing networking​
andre [41]
A computer network is a group of computers that use a set of common communication protocols over digital interconnections for the purpose of sharing resources located on or provided by the network nodes.
6 0
3 years ago
Consumers affect which goods and services are produced because they _____.
arlik [135]

Answer:

Choice B, "choose which goods and services to buy"

Explanation:

Consumers choose which goods and services to buy. Companies only want to provide goods and services they know will be bought. Therefore, consumers affect which goods and services are produced because they choose which goods and services to buy.

3 0
2 years ago
Other questions:
  • Mark, David, Tia, and Ashley are team members in a computer programming class. They have been assigned the task of creating a co
    12·1 answer
  • Select the correct answer. Larry finds it easy to run legacy programs and applications in a virtualized environment. How does th
    5·1 answer
  • How do you change your age on here? I accidentally put that i was 15 but i am only 13. How do I change this?
    12·1 answer
  • 1. Accessing calendars, contact information, emails, files and folders, instant messages, presentation, and task lists over the
    7·1 answer
  • How is kerning used in Word?
    7·2 answers
  • You are attending to a neighbor who is unresponsive, not breathing normally, and pulseless. Your spouse has left to activate EMS
    8·1 answer
  • Look at the network topology. What will happen with the other computers if the computer breaks at the RED X?
    8·1 answer
  • Larry does not want to save his internet browsing details on his computer. What files should Larry delete to clear his informati
    13·2 answers
  • What is a mod in programming?<br><br> Give more Java questions
    12·1 answer
  • I came here for a answer so why did i get a pep talk
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!