Monday, 6 July 2015

Write C Program To Find Factorial of Inputed Number

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

No comments:

Post a Comment