Skip to main content

Factorial of a number

#include <stdio.h> int main() { int n, fact = 1; printf("Enter the value of n : "); scanf("%d" , &n ); printf("\n"); for(int i = 1 ; i <= n; i++ ) { fact = fact * i; } printf("The factorial of %d is %d", n, fact); }




Comments