YCP Logo Lab 8: Factorial

Due: Friday, Sept 19th by 11:59 PM

Getting Started

If you have a solution open in Visual Studio, close it (File->Close Solution).

Download CS200_Lab8.zip. Import it into Visual Studio (File->Import...).

Add your code to the source file called Fact.c.

Your Task

Prompt the user to enter a positive integer. Compute the factorial of that number.

The factorial of an integer n is defined as the product computed as follows:

1 x 2 x 3 x ... x n

Example run (user input in bold):

Enter a positive integer: 6
The factorial of 6 is 720


Here is a suggested approach:

Your loop variable should be an integer. Initially, the loop variable should be 1. Each iteration of the loop should increase the loop variable by 1. The loop should terminate when the loop variableis greater than the number entered by the user.

A separate variable should be declared to hold the computed product. It should initially be set to 1. Each iteration of the loop should multiply the current product by the loop variable, storing the result back into the product variable.


When you are done, choose Tools->Submit to submit your completed lab to the server. You will need to enter your Marmoset username and password.

If the Tools->Submit option does not work, create a zip file containing the files in your project, and upload it to the submission server as lab8. The server URL is