Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do not use Arrays or Pointers. Write in C++ Code. Goals: Practicing loop/repetition structures and functions Create a program that will calculate the factorial of

Do not use Arrays or Pointers.

Write in C++ 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions