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
(03 MC)Why is it important to set goals and share them with others?
Ad libitum [116K]

Answer:

answer is b

Explanation:

hope it was helpful

3 0
3 years ago
WordArt styles allow you to add ____.
maria [59]
As for this problem, the most probable and the most likely answer to this would be it depends on the person or the user of it since there aren't any options presented with the problem.

WordArt is there to be of use during presentations, during discussions, and other things. On the other hand, as the technological advancement takes leaps and bounds going forward, this utility seems to be underused and isn't expected to give a more impact to the reader or to the recipient of such document that contains it. This is typically used for people that aren't too familiar yet, as to how to utilize other programs to enhance their documents and files.
3 0
3 years ago
Types of computer that we use in our daily life​
ozzi

Answer:

all coumputers

Explanation:

i just like coumputers

5 0
3 years ago
Read 2 more answers
What type of USB connector is always plugged into the computer to connect in external device
barxatty [35]
HDMI? I am not entirely sure
4 0
3 years ago
When you write contracts, should you list many definitions at the start of the document?
aev [14]

Answer:

You can.

Explanation:

If you want you can, but usually as you cover topics you should list the definitions for each topic then instead of all at the beginning you do not want it to seem like it is a lot.  

4 0
3 years ago
Other questions:
  • How is the JOptionPaneclass used to display a dialog box that performs a yes/noconfirmation?
    10·1 answer
  • You're an administrator for a large corporation and you are responsible for deploying computers often and quickly. What server d
    10·1 answer
  • Ann wants to save her presentation so she can work on it later. Which device on her computer can store this data long term?
    14·1 answer
  • What areas do you need to grow your knowledge in to understand your financial future?
    12·1 answer
  • What is the first step a user should take toward generating an index?
    7·1 answer
  • How does natural gas move through pipelines from the well head to the end user thousands of miles away
    5·1 answer
  • Why would researching the average earnings by major and by career be useful to you as you choose an institute for higher educati
    10·1 answer
  • What are the three main elements common to all radio ads?
    9·2 answers
  • Hey, how do we get our warnings removed? I got one and I didn't realize that what I did was wrong.
    6·2 answers
  • What does it mean when someone says your voice doesn’t match how u look
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!