Thursday 3 October 2013

Finding Factorial of a number using C

#include<stdio.h>
main()
{
int n,i,fact=1;
printf("\n(There is) none worthy of worship except Allah(Subhanahu wa ta'ala).Muhammad(Sallallahu alayhi wasallam) is Messenger of ALLAH(Subhanahu wa ta'ala).\n");
printf("Enter the no for which factorial is to be determined\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
fact=fact*i;
}
printf("Factorial of %d is %d\n",n,fact);
}

No comments:

Post a Comment