C.Factorial of Given number using for

 


#include<stdio.h>

int main()

{

   int i=0,n,factorial=1;

      printf("Enter No. to Print Factorial:\n");

   scanf("%d",&n);

   for(i=1;i<=n;i++)

   {

       factorial=factorial*i;

       //factorial *=i;

   }

   printf("\nFactorial is %d",factorial);

}

Comments