Question: Write 2 small functions total and factorial to do the following: 1. Function total use DO-WHILE loop to calculate the sum from 1 to n
Write 2 small functions total and factorial to do the following: 1. Function total use DO-WHILE loop to calculate the sum from 1 to n where n is an input parameter. 2. Function factorial uses FOR loop to rewrite the WHILE loop inside the definition of function factorial.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
