1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

factorial

Discussion in 'C++' started by Plutocracy, Dec 19, 2010.

  1. Plutocracy

    Plutocracy New Member

    Joined:
    Nov 10, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    i'm trying to develop a program that can calculate factorial, but i'm not getting the exact result i want, so i'm asking if anyone can help me by giving me the procedures to follow to get the result i'm after.
    the formula is (n*(n-1)*(n-2)*(n-3)...), please help me get the result. Thanks to all.
     
  2. adityabokade_ct

    adityabokade_ct New Member

    Joined:
    Jan 1, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Re: snippet to solve ur factorial

    fact=1;
    for(i=n;i>=1;i--)
    {

    fact=fact*i;
    }
    printf("%d",fact);

    thats it!
     

Share This Page