hey guys thanks for all your help... ive tryed all the codes and pj yeltons seems to be the one which is almost working but still coming up with the wrong results

5! should =120 showing 125

4! should = 24 showing 64

etc

ive tryed playing around with it, changing the values and for loops but still no succes. ive put it into a seperale little main function below, just incase anyone has some free time to cut n paste it into their c++ compiler..

thanks guys

Code:

void main()
{
printf("enter a num:");
scanf("%d", &factorial);
int n, count, answer;
int i = 1;
int temp = factorial;
for(n = factorial ; n>0 ;n--)
for(count = factorial - i; count >0; count--)
{
answer = answer + temp;
}
i++;
temp = answer;
printf("\n\nThe factorial of %d! is %d\n\n",factorial, answer);
}