Question:

Please tell me What Is Factorial ?

by  |  earlier

0 LIKES UnLike

Plz Tell Me what Is Factorial? And Also Program In 'C'

 Tags:

   Report

5 ANSWERS


  1. The ! is used in math to denote "factorial". Examples:

    2 factorial = 2! = 1 x 2

    3 factorial = 3! = 1 x 2 x 3

    7 factorial = 7! = 1 x 2 x 3 x 4 x 5 x 6 x 7

    In general, n! = 1 x 2 x 3... x n

    Programming this is straightforward, but you should do your own homework assignments, so I won't supply the program. 8-)


  2. on a side note...

    0! = 1; because we said so....

  3. For example, 5! would be 5x4x3x2

    6! would be 6 x 5 x4 x 3 x 2

    here's a little function that calculates factorial.

    double factorial(int x)

    {

    double sum = x;

    for(int i = x-1; i > 1; i--)

    sum = sum * i;

    return sum;

    }

    factorials get big fast, byw, so be aware of this in your code.


  4. The ! is used in math to denote "factorial". Examples:

    0! = 1

    2 factorial = 2! = 1 x 2

    3 factorial = 3! = 1 x 2 x 3

    7 factorial = 7! = 1 x 2 x 3 x 4 x 5 x 6 x 7

    In general, n! = 1 x 2 x 3... x n

    pgm for factorial will be

    double factorial(int x)

    {

    double sum = x;

    for(int i = x-1; i > 1; i--)

    sum = sum * i;

    return sum;

    }

    call the function in the main function and pass the value to it.ok.


  5. for ex:3!=3*2*1

             5!=5*4*3*2*1

    find factorial of 6 i.e n=6

    while(n<=1)

    {

        sum=n*1;

        n=n-1;

    }

    printf("The factorial of 6 is :%d",sum);

Question Stats

Latest activity: earlier.
This question has 5 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.