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 following can be thrown using the throwstatement?
Amanda [17]

Answer:

All of Given

Explanation:

The throw keywords can be used to throw any Throwable object. The syntax is :

throw <Throwable instance>

Note that Error and Exception are subclasses of Throwable while RuntimeException is a subclass of Exception. So the hierarchy is as follows:

Throwable

-- Error

-- Exception

   -- RuntimeException

And all of these are valid throwable entities. As a result "All of Given" is the most appropriate option for this question.

6 0
3 years ago
Read 2 more answers
Identify the following keys. write AK for Alphanumeric keypad,NK for Numeric Keypad,CK for Cursor Key, FK for Function keys and
natali 33 [55]

Answer:need points for stuff

Explanation:

4 0
2 years ago
What is a general term for a type of database which is endlessly and easily scalable without a measurable performance decrease
Andrews [41]

Answer:

<u>Scalable database</u>

Explanation:

Good examples of a scalable database include; NoSQL database, MySQL, Microsoft SQL.

<em>Remember</em>, these databases are called scalable databases because they support memory expansion without a measurable performance decrease.

For example, if the management of a hotel notices that its 1 terabyte computer used to store its security videos is no longer adequate to meet the hotel's expansion, then decide to buy a newer server that can be integrated into the current system. We can say they just applied the concept of scalable databases.

4 0
3 years ago
What role does normalization play in good and bad table structures, and why is normalization so important to a good table struct
Ahat [919]

Explanation: Normalization is the process through which the reduction in the redundancy of data can happen.It makes the redundant in control which decrease the issue of the data integrity that appears in the good and bad database tables.

In good tables it functions for the storing of the objects in the relational database which is a difficult task and thus helps in the linking of the tables of databases.The same information level can be maintained for the different places. These are reason that normalization is important for the good table.

8 0
3 years ago
Which of the following terms refers to the horizontal line of continuous cells in a table?
vova2212 [387]

I believe it's a Row and A Intersection, though I'm not completely sure.

3 0
3 years ago
Read 2 more answers
Other questions:
  • How might your use of computers and knowledge of technology systems affect your personal and professional success?
    7·2 answers
  • rob just got a new idea for the movie he's making, and he wants to put in late hours to get it done. Which of the following stat
    10·1 answer
  • The manager of a sports club has data about the club members' ages in a workbook. He wants to find which age is most common. Whi
    13·2 answers
  • All animations on the world wide web are flash animations
    11·2 answers
  • The basic input/output system (bios locates the boot loader program on a linux system by reading the __________ on the hard driv
    13·1 answer
  • The set of rules for how computers talk to one another
    6·1 answer
  • Which of the following, (1) money deposited in a bank account, (2) student recording her answer to a question in an online test,
    9·1 answer
  • What is the practical application of the information acquired by science.
    15·1 answer
  • Please answer fast..​
    15·1 answer
  • Java question
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!