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
The navigation items for a Lightning app are available on mobile: A. In a special mobile configuration in the navigation menu an
mr_godi [17]

Navigation items are used for moving from one part of the part to a destination using actions and also for passing information. The right option is  <em>C. In the navigation menu and the first four items of the </em><em>navigation bar</em><em>, when users are in the app </em>

<em />

There are different methods/ways to implement the Navigation component in a mobile application, we have the following type of Navigation Implementation

  1. Bottom Navigation
  2. Drawer Navigation(Slides from Left to right)
  3. Top Navigation

Learn more about Navigation here:

brainly.com/question/8908486

5 0
2 years ago
What is the importance of using the proper markup language?
Klio2033 [76]

the answer is D. without the right tags the content wont be accurately indexed

3 0
3 years ago
Read 2 more answers
A. Write a program that asks the user to enter an integer, then prints a list of all positive integers that divide that number e
kobusy [5.1K]

Answer:

Following are the program in python language the name of the program is factors.py

num= int(input("Please enter a positive integer: "))#Read the number by user

print("The factors of ",num,"are:")

for k in range(2,num): #iterating over the loop

   if(num%k==0): #checking the condition

       print(k)#display the factor

Output:

Please enter a positive integer: 12

The factors of 12 are:

2

3

4

6      

Explanation:

Following are the description of the program

  • Read the number by user in the "num" variable
  • Iterating the for loop from k=2 to less then "num".
  • In the for loop checking the factor of "num"  variable by using % operator.
  • Finally display the factor by using print function
4 0
3 years ago
What is the difference, if any, between a Portable Media Player (PMP) and a Digital Media Device (DMD)? PMPs can be analog or di
lara [203]

Answer:

PMPs are typically referred to interchangeably.

Explanation:

3 0
3 years ago
Which rules should be remembered when creating formulas using nested functions? Check all that apply.
White raven [17]

Answer:

Use an equal sign at the beginning of the formula (A)

Use open and close parenthesis for each set of nested functions (B)

Functions should be in CAPS

Separate functions with commas

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • In the two-level directory, if a user refers to a particular file then__________________ Select one: a. only his/her own UFD (us
    7·1 answer
  • Most graphics software uses a process called pixel _________ to create new pixels by averaging the colors of nearby pixels.â
    6·1 answer
  • Consider the following statements: #include #include class Temporary { private: string description; double first; double second;
    9·1 answer
  • Suppose Alice, Bob, and Carol want to use secret key technology to authenticate each other. If they all used the same secret key
    10·1 answer
  • If you want a user to actively participate in an online activity, create a web ______________.
    12·2 answers
  • The words that follow a code number in the cpt manual are called the
    12·1 answer
  • Which of the following is an example of a trade journal?
    7·2 answers
  • 2ND LAST QUESTION
    13·1 answer
  • If an ______ is caught dumping hazardous materials, that person can be prosecuted. Answer choices A) Employee B) Employer C) Bot
    7·1 answer
  • Create a multimedia project that contains the text element and all the contents that you have studied about that element
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!