The factorial of a positive integer N, denoted by N!, is defined by the following: N! =

Question:

The factorial of a positive integer N, denoted by N!, is defined by the following:

N! = 1 × 2 × . . . × N (Note: 0! = 1 )

Using subprograms and functions, create a recursive program to compute N!. The user should input a positive integer and a subprogram should check that the input is correct (a positive integer). Then use recursion to compute the factorial. Create a subprogram that will call itself to do the multiplication until N = 1. Then display the result in the main program.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Prelude To Programming

ISBN: 9780133741636

6th Edition

Authors: Stewart Venit, Elizabeth Drake

Question Posted: