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]
4 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]4 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
WILL UPVOTE ALL plz
OverLord2011 [107]
D-ash is the answer.
8 0
3 years ago
You're the administrator for a large bottling company. At the end of each month, you routinely view all logs and look for discre
Natali [406]

Answer:

It seems as though it would be a DDoS attack.

Explanation:

The characteristics are as follows:

A slow down of operations and attempting to get access into said service.

4 0
3 years ago
In a newspaper advertisement for a hybrid car, which of these presentation methods would be most effective
faltersainse [42]
Your answer is a....
6 0
3 years ago
Read 2 more answers
How would a programming language that allows programs to run on any operating system be classified?
Illusion [34]
Cross-platform.





--------------------
3 0
3 years ago
Questione
umka2103 [35]

Answer:

According to my physics all of functinalitys are made of angles and binary code to perform a new formula and involved to each sides....

Explanation:

HOPE IT HELPS!!!i translate into G your language

5 0
3 years ago
Other questions:
  • Ella has finished drafting her presentation. What should she do next?
    6·2 answers
  • Ted is asked to create a page of family photos for his family reunion Web site. He will have about 20 pictures to post, with a c
    5·1 answer
  • Which of the following statements opens the file info.txt for both input and output? a) dataFile.open("info.txt", ios::in &amp;&
    11·2 answers
  • The computer system provides an internal clock that sends an interrupt periodically to the CPU signaling that it’s time to start
    11·1 answer
  • Suppose L is a LIST and p, q, and r are positions. As a function of n, the length of list L, determine how many times the functi
    8·1 answer
  • Pen registers and trap-and-trace devices are not considered forms of searches and do not need probable cause and a court order b
    10·1 answer
  • A photographer is reading about how to ensure a high-quality photographic print. Which statements convey the best way to ensure
    5·1 answer
  • DRAG DROP -A manager calls upon a tester to assist with diagnosing an issue within the following Python script:#!/usr/bin/python
    11·1 answer
  • Two character strings may have many common substrings. Substrings are required to be contiguous in the original string. For exam
    7·1 answer
  • You learned that you can use the tags to insert a link to another webpage. One problem that webpage developers face is that, aft
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!