Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Try to only use loops/repetition structures and functions and only basic code Goals: Practicing loop/repetition structures and functions Create a program that will calculate the
Try to only use loops/repetition structures and functions and only basic code
Goals: Practicing loop/repetition structures and functions Create a program that will calculate the factorial of a positive number using a function that you build. Your main function should prompt the user to enter a positive whole number and robustly confirm the number is greater than zero. (You may assume the number is a whole number and do not have to check that the number is whole.) Then your code should call the function to calculate the factorial, store the value returned from the function in a variable. Next main should output the original number and the factorial. Do not put the function call in a cout statement. Your function should accept the whole number as a parameter, then use a loop to calculate the factorial. The resultant factorial should be returned to main function for output. Do not use any concepts beyond Chapter 6 (e.g. arrays) of your textbookStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started