Sunday, April 18, 2010

Quo Reviews Cosmetics

Calculate Factorial of a Number Posted in C + +

Another common exercise in programming courses is to design a program that will calculate the factorial a number entered.

The statement is as follows:
Create a program that reads a number n and to calculate the factorial.
Well, here we go.

  # include \u0026lt;iostream.h>  

int a, b, factorial;

int main (void )

{court \u0026lt;\u0026lt;"This program will calculate the factorial of integer number type \\ nPlease enter number "\u0026lt;\u0026lt;endl;
cin>> a;
factorial = 1;
for (b = 1, b \u0026lt;= a, b + +) {
factorial
= b * factor;}


court \u0026lt;\u0026lt;"The factorial the number entered is "\u0026lt;\u0026lt;factorial \u0026lt;\u0026lt;endl;

system (" pause ");
return 0;}
As in our previous example of C program to perform power calculations is very important before the cycle to initialize the value of the cumulative multiplication with multiplication module, which is the one.
Without this small detail, the program would give you load with errors.

0 comments:

Post a Comment