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
alukav5142 [94]
3 years ago
15

Write a C program that includes a function of type double called divemaster accepts two double arguments (you must write the div

emaster function). When called, your function will return the first argument divided by the second argument. Make sure your function includes a decision statement so that it can't divide by 0--if the caller attempts to divide by 0 the function should return a value of -1.0.
Computers and Technology
1 answer:
Firlakuza [10]3 years ago
6 0

Answer:

Following is the C program to divide two numbers:

#include<stdio.h>

double divemaster (double first, double second)

{

//Check if second argument is zero or not

if(second!=0)

    return first/second;

else

 return -1.0;

}

int main()

{

printf("%f\n", divemaster(100,20));

printf("%f\n", divemaster(100,0));

}

Output:

5.000000

-1.000000

Explanation:

In the above program, a function divemaster is declared which divedes the first argument with second and return the result.

Within the body of divemaster function if else block is used to verify that the  second argument is not zero, and thus there is no chance of divide by zero error.

In main two printf statements are used to call the divemaster function. One to check normal division process and second to check divide by zero condition.  

You might be interested in
What is the relationship between interoperability and the other quality attributes highlighted in this book? For example, if two
Lina20 [59]

Answer:

Interoperability is the ability of or degree to which two or more systems usefully exchange information via interfaces in particular context. Interoperability can be defined in two ways which includes the ability to exchange data (syntactic interoperability) and also the ability to correctly interpret the data being exchanged (semantic interoperability).

If two systems failed to exchange information properly, it means they are not clear to interpret and not easy to communicate and get proper information from each other and that might result in a failed communication which is in turn result in security flaw.

Other quality attributes strongly related (at least potentially) to interoperability is Application Programming Interface (API)

API is a software intermediary that allows two applications to communicate to each other and are necessary for systems interoperability.

8 0
4 years ago
What does "ttyt" stand for?
EastWind [94]
TTYT stands for "talk to you tomorrow".
6 0
4 years ago
Read 2 more answers
Which of these statements would create a variable but not assign anything to it?
Ugo [173]

Answer:

variable = null

Explanation:

that one would fasho

7 0
3 years ago
Read 2 more answers
Which of the following correctly describe the term readability as used in design
Lisa [10]

Readability is how legible the text is. Can you read the text easily?

8 0
3 years ago
From MCYT who was the the one who said "SUCK IT GREEN BOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOY"
Papessa [141]

Answer:

Tommyinnit

Explanation:

8 1
3 years ago
Read 3 more answers
Other questions:
  • A quick boot allows you to do what?
    7·2 answers
  • A(n) ____ is the computer counterpart to an ordinary paper file you might keep in a file cabinet or an accounting ledger.a. data
    6·1 answer
  • ____________ is a widely accepted international best practices framework for implementing information systems security.
    12·1 answer
  • Help!!!! ASAP TIMED TEST 50 points!!!!
    7·1 answer
  • What are the defenses to protect against these attacks?
    13·1 answer
  • Site at least 3 articles of impact of internet that affect in our daily lives.
    15·1 answer
  • 2. Select the things you can do when working with rows in columns in a spreadsheet:
    5·1 answer
  • A new thread begins its life cycle by transitioning to the ________ state. Group of answer choices new runnable waiting terminat
    9·1 answer
  • As of 2019, approximately how much of the world population actively access the internet?
    7·1 answer
  • Can somebody please help me with these few questions?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!