CPPForSchool.com: User Defined Function Set 1: Assignment 2

2. Write a function to calculate the factorial value of any integer as an argument. Call this function from main( ) and print the results in main( ).


This assignment was a bit of an eye opener.  In the past, I have gotten rather accustomed to return 0 and utilizing custom void functions.  For this assignment, I had to ensure that I returned the factorial in order for the values to be relayed into int main().  Nevertheless, I had a pretty good time coding this exercise.  Below is my source code and outputs.  Also, the sample source and output has been posted for comparison.









Comments

Popular posts from this blog

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 9

CPPForSchool.com: Array - Single Dimension Set 1 Assignment 6

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 8