Bifalgorithm post · Computer science one · Void Functions
How do C functions return values to the calling function?
How do C functions return values to the calling function? (Computer science one · Void Functions) — "18.1. Defining & Using Functions\n\ndouble getDistance(dou…
Ideas in this flowchart
- Defining and using functions
- The getDistance function calculates the distance between two points.
- It receives the coordinates x1, y1, x2, and y2 as parameters.
- It calculates the differences between the corresponding coordinates.
- It returns the square-root distance formula result.
- The getMonthlyPayment function calculates a monthly payment.
- It receives principle, apr, and terms as parameters.
- It calculates the monthly rate by dividing the APR by 12.
- It calculates the payment using the principal, rate, and number of terms.
- The return keyword specifies the value returned to the calling function.