Essay on Integer

Submitted By spateljanu0906
Words: 370
Pages: 2

Lab 3

Using the for Looping (Repetition) Structure design a program that prompts the user to enter a positive integer number. Use a for loop to calculate and display the factorial value of that number. A factorial number is a number multiplied by every factor between 1 and the number, inclusive. For instance, 3 factorial is 3 * 2 * 1. If the user enters a negative number, display a message indicating that the program calculates only positive numbers. Otherwise, display the result of the calculation. // Enter your name as a comment for program identification
// Program assignment Factorial.cpp
// Enter your class section, and time
/* The program Factorial1.cpp is a program that prompts the user to enter a positive integer number. The program will then use a for loop to calculate and display the factorial value of that number. This program increments the counter in the for loop. A factorial number is a number multiplied by every factor between 1 and the number inclusive. For instance 3 factorial is 3 * 2 * 1. If the user enters a negative number, display a message indicating that the program calculates only positive numbers. Otherwise, display the result of the calculation.
/* The input is a positive integer number. */
/* The factorial value of the number entered or a message indicating that the number is not positive. */
// header files
/* use the correct preprocessor directives for input/output */
// declare variables
/* declare an integer variable number to input a value and a integer variable factorial initialized to 1 to calculate the factorial value of the number entered */
//