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
In what location along a river are you most likely to find a hydropower plant?
saul85 [17]

Answer:

I need help with that too I have that too

Explanation:

3 0
3 years ago
In terms of salary and wages, an applicant should:
Roman55 [17]
Address the issue to the employer after being hired.
7 0
4 years ago
Jeff was explaining to a friend the importance of protecting a cryptographic key from cryptoanalysis. He said that the key shoul
Lisa [10]

Answer:

Jeff is describing confusion

Explanation:

In 1945, Claude Shannon gave a classified report on: "Mathematical Theory of Cryptography" where he stated that confusion and diffusion are two properties of the operation of a secure cipher which are very essential in cryptanalysis.

When each bit of the ciphertext depends on several parts of the key, secluding the connections between the ciphertext and the key, it is known as confusion.

Hence, Jeff saying that the key should not relate in a simple way to the cipher text describes confusion.

7 0
3 years ago
In object-oriented terms, a(n) ____________________ defines an object’s behavior
Phoenix [80]
Do you have any answer choices?
5 0
3 years ago
On Election Day, TV news network Houston News One is trying to project the 2018 Texas election results. They send pollsters to 4
Leni [432]

Answer:

entrance poll

Explanation:

Based on the information provided within the question it seems that the type of poll that the news network is conducting is an entrance poll. This refers to asking question (poll) to people outside of the voting center before they enter to place their vote as opposed to exit poll which is done after the individual has placed their vote.

8 0
3 years ago
Other questions:
  • Memory management is concerned with __________.
    14·1 answer
  • Explain why Windows and Linux implements multiple locking mechanisms. Describe the circumstances under which they use spinlocks,
    13·1 answer
  • Differences between barcode reader and character recognition devices​
    9·2 answers
  • Work-based learning can be defined as educational experiences that focus on
    11·1 answer
  • A skillful response consist of two parts: affirmation andanswer<br><br> True<br><br> False
    10·1 answer
  • What does an IT worker do
    8·1 answer
  • Write an expression whose value is the concatenation of the three strigs name1, name2, and name3, separated by commas
    9·1 answer
  • When data can flow across a cable in both directions, this is known as___Communicating?
    15·1 answer
  • You have learned a lot about the types of careers that are involved with building a playground. Create two job descriptions of p
    7·2 answers
  • Does every loop structure require curly braces?<br> A. yes<br> B. no
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!