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
(50 points) Jeff wants to create a responsive web page where elements change size according to the size of the window. How would
iris [78.8K]

Answer:

make the element sizes a percentage

Explanation:

Without using a framework specified for this type of thing such as Bootstrap, the best way to do this would be to make the element sizes a percentage. By making the size of everything a percentage it will automatically resize itself to take up the same percentage of the screen at all times. Even when the browser window is resized to any size that the user wants. This also applies to monitors of different sizes and mobile devices.

5 0
3 years ago
Pixel Data
pashok25 [27]

Answer:

-The correct width and height must be input into the pixelation widget to produce the image.

- The fact that only 32 bits were used to represent the image indicates relatively large sample squares were used. The digital image may vary from the analog image significantly.

Explanation:

8 0
3 years ago
Before you start creating a database, you should first use paper to plan, test, and revise. True False
Licemer1 [7]
<span>Before you start creating a database, you should first use paper to plan, test, and revise. True or False?
TRUE</span>
8 0
3 years ago
Read 2 more answers
An organization needs to maintain data files of its employees in the form of tables. They also need to access and update over th
MrMuchimi
Database software seems to be the most logical.
5 0
3 years ago
Read 2 more answers
Output the following 21%4​
Vadim26 [7]
21%4 is 1.

21-4=17
17-4=13
13-4=9
9-4=5
5-4=1
4 0
3 years ago
Other questions:
  • The file containing the definitions of the member functions of class DateType is called the ______ file.
    6·1 answer
  • Can someone pls explain this question??
    7·1 answer
  • A company decides to reduce its IT labor force by hiring an external company to manage various aspects of IT administration, suc
    6·1 answer
  • A new computer workstation has been installed in a small office. the user of the workstation can print a document using a networ
    9·1 answer
  • What font option will elevate part of the text to a higher level and decrease its size? A. Subscript
    8·1 answer
  • Another html/css assignment, drop css code below, thank you
    15·1 answer
  • Sort short_names in reverse alphabetic order.
    11·1 answer
  • Given an integer n and an array a of length n, your task is to apply the following mutation to an: Array a mutates into a new ar
    5·1 answer
  • Fill in the blank
    15·2 answers
  • • R7.9 Write enhanced for loops for the following tasks.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!