Write the prototype of a function ‘divide’ that takes two integers values and returns the quotient of double type
Answers
A function is a reusable portion of a program, sometimes called a procedure or subroutine.
Like a mini-program (or subprogram) in its own right
Can take in special inputs (arguments)
Can produce an answer value (return value)
Similar to the idea of a function in mathematics
Why write and use functions?
Divide-and-conquer
Can breaking up programs and algorithms into smaller, more manageable pieces
This makes for easier writing, testing, and debugging
Also easier to break up the work for team development
Reusability
Functions can be called to do their tasks anywhere in a program, as many times as needed
Avoids repetition of code in a program
Functions can be placed into libraries to be used by more than one "program"
With functions, there are 2 major points of view
Builder of the function -- responsible for creating the declaration and the definition of the function (i.e. how it works)
Caller -- somebody (i.e. some portion of code) that uses the function to perform a task
Using Functions
hope this helps you