Mail your problems to us on, we will solve it and put the solution here at

Factorial program in c using function

#include <stdio.h>
long factorial(int);
int main()
  int number;
  long fact = 1;
  printf("Enter a number to calculate it's factorial\n");
  scanf("%d", &number);
  printf("%d! = %ld\n", number, factorial(number));
  return 0;
long factorial(int n)
  int c;
  long result = 1;
  for (c = 1; c <= n; c++)
    result = result * c;
  return result;
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment


Post a Comment