C Program to find factorial of a number 

#include<stdio.h>
main()
{
  int number,factorial=1,i;
  printf("Enter a number for knowing it's factorial\n");
  scanf("%d",&number);
  for(i=1;i<=number;i++)
  {
   factorial=factorial*i;
  }
  printf("%d!=%d\n",number,factorial);
}

Output:-
Enter a number for knowing it's factorial
5
5!=120

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post