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
Consider the following protocol for concurrency control. The database system assigns each transaction a unique and strictly incr
nasty-shy [4]

Answer:

(a) yes, this protocol allows only serializable schedules for transactions as due to this the system maintains it's consistency. As in this protocol a unique transaction id is being assigned and with the help of that transaction id the system would be able to identify the process which has taken place in what particular order. For example, in case of bank transfers

balance = 1000 transaction id 100

write ADD 200 transaction id 101

write SUB 1100 transaction id 102

write ADD 900 transaction id 103

in here with the help of transaction id we can check which operation has happened in which order, if not then some operation will not happen like 102 immediately after 100 and skipping 101

(b) the modified version of this protocol would be to also consider the time of transaction and take this factor in the consideration

4 0
3 years ago
Use the drop-down menus to complete statements about archiving and backing up data fileArchiving data files manages the size of
svetoff [14.1K]

Answer:

Archiving data files manages the size of a mailbox for  

✔ local

storage.

Creating an Outlook data file  

✔ protects

data files in storage on a computer.

Explanation:

Because its right.

3 0
3 years ago
Read 2 more answers
Write a program with a function that accepts a string as an argument and returns the number of uppercase, lowercase, vowel, cons
diamong [38]

Answer:

Explanation:

The following code is written in Python. It is a function called checkString that takes in a string as an argument and loops through each char in that string and checking to see if it is lowercase, uppercase, vowel, consonant, or punctuations. It adds 1 to the correct variable. At the end of the loop it prints out all of the variables. The picture below shows a test output with the string "Brainly, Question."

def checkString(word):

   uppercase = 0

   lowercase = 0

   vowel = 0

   consonants = 0

   punctuation = 0

   vowelArray = ['a', 'e', 'i', 'o','u', 'y' ]

   consonantArray = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']

   punctuationArray = ['.', '!', '?', ',', ';', '(', ')']

   for char in word:

       if char.isupper():

           uppercase += 1

       else:

           lowercase += 1

       if char.lower() in vowelArray:

           vowel += 1

       elif char.lower() in consonantArray:

           consonants += 1

       if char in punctuationArray:

           punctuation += 1

   print('Uppercase: ' + str(uppercase))

   print('Lowercase: ' + str(lowercase))

   print('Vowels: ' + str(vowel))

   print('Consonants: ' + str(consonants))

   print('Punctuations: ' + str(punctuation))

8 0
3 years ago
What is the impedance mismatch problem? Which of the three programming
kykrilka [37]

Answer:

The problem that created due to the difference in the model of programming language and the database model.

Explanation:

The practical relational model has three components which are as follows

1. Attributes

2. Datatypes

3. Tuples

To minimize this problem  

1. We switch low pass L-Network to high pass L-network

2. We switch high pass L-Network to low pass L-network

3. We use the impedence matching transformer

3 0
3 years ago
If you need to multiply 50 and 8 and divide by 2, what would you type on the numerlc keypad?
nata0808 [166]

Answer:

50*8/2

The asterisk is the multiplication sign and the parenthesis is the division.

I've never used an apostrophe for a multiplication sign before, but I'm guessing multiplication is what it stands for.

Explanation:

4 0
2 years ago
Other questions:
  • What is the 7 X 7 when referring to PowerPoint presentations?
    12·2 answers
  • Identify the false statement.
    8·1 answer
  • Which line in the following program contains the header for the showDub function? 1 #include«iostream» 2 using namespace std; 4
    15·1 answer
  • This device is used to connect sections of large networks?
    12·2 answers
  • Which command compiles the Java source code file Welcome.java?
    11·1 answer
  • What is the root of the tree?
    6·1 answer
  • Write a method, findMax(), that takes in two integers and returns the largest value. Ex: If the program input is: 4 2 the method
    8·1 answer
  • Microsoft Word, Google Chrome, and Windows Media Player are examples of
    15·1 answer
  • An instruction for the computer. Many commands put together to
    5·1 answer
  • How should excel Identify social security numbers: as a text, numbers, or date and time? Why?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!