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
NEED HELP AGAIN
Anestetic [448]
The answer to the question is D)
8 0
3 years ago
Read 2 more answers
I have a question about a hotel tv:
UNO [17]

1 Open the back cover of the Nintendo Switch Dock.

2 Connect the USB plug from the Nintendo Switch AC adapter (model No. ...

3 Connect one end of the HDMI cable into the bottom terminal of the dock labeled "HDMI OUT," then connect the other end into an HDMI port on your television or monitor.

                                                                                                   your welcome

3 0
3 years ago
A 'deny any-any' rule in a firewall ruleset is normally placed: a. Nowhere in the ruleset if it has a default allow policyb. Bel
tia_tia [17]

Answer:

D. . At the bottom of the ruleset

Explanation:

The main purpose of firewalls is to drop all traffic that is not explicitly permitted. As a safeguard to stop uninvited traffic from passing through the firewall, place an any-any-any drop rule (Cleanup Rule) at the bottom of each security zone context

6 0
4 years ago
A group of computers that are interconnected in order to share information or documents is called what?
Rufina [12.5K]
It is a type of network . and the network's name is computer network
4 0
3 years ago
Write a program that passes an unspecified number of integers from command line and displays their total.
Svetradugi [14.3K]

Answer:

Explanation:

I will go straight to the code, and hope it didn't confuse you.

Here is it

public static void main(String[] args)

int [] x = new int [args.length]

for (int y = 0; y< args.length;yi++)

int[y] = (int) args [y]

5 0
3 years ago
Other questions:
  • What does gps stand for ?
    15·2 answers
  • What does DOS stand for?
    15·1 answer
  • Need help developing code!!
    9·1 answer
  • What are the differences between the various EHRs?
    9·1 answer
  • Access Help defaults to searching for information on the _________.<br><br> Not multiple choice
    10·1 answer
  • In a management information system, the quality of information is determined by its usefulness to users, and its usefulness dete
    8·1 answer
  • In many DBMSs where no strict separation of levels is maintained, this one language is used by the DBA and database designers to
    13·1 answer
  • You are configuring two PCs for your network, PC-A is given an IP address of 192.168.1.18 and PC-B is given an IP address of 192
    15·1 answer
  • For the following 4-bit operation, assuming these register are ONLY 4-bits in size, which status flags are on after performing t
    14·1 answer
  • JAVA
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!