Factorial program in c C Programming Friday, May 15, 2015 Reading Add Comment face.c #include <stdio.h> int main() { int c, n, fact = 1; printf("Enter a number to calculate it's factorial\n"); scanf("%d", &n); for (c = 1; c <= n; c++) fact = fact * c; printf("Factorial of %d = %d\n", n, fact); return 0; } output Enter a number to calculate it's factorial 6 Factorial of 6 = 720 C Programming C Programs Share: Facebook Twitter Google Plus Pinterest Related Articles
0 comments:
Post a Comment