Factorial program in C using a for loop

                       Factorial program in C using a for loop

  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.   int c, n, fact = 1;
  6.  
  7.   printf("Enter a number to calculate its factorial\n");
  8.   scanf("%d", &n);
  9.  
  10.   for (= 1; c <= n; c++)
  11.     fact = fact * c;
  12.  
  13.   printf("Factorial of %d = %d\n", n, fact);
  14.  
  15.   return 0;
  16. }

For complete Video Tutorial Visit our YouTube Channel TECHFOSHA 
Previous Post Next Post