Tuesday, 30 June 2015

C Program To Find Factorial Of A Number

For those who are looking for an easy program to find out the factorial of a number using C language, Here we have the right answer for you. Just try out our code given below:


#include<stdio.h>
main()
{
    long long int i,j=1,k;
    printf("Enter a number: ");
    scanf("%d", &i);
    for(k=1; k<=i; k++)
    {
        j=j*k;
    }
    printf("The factorial of given value is: %lld", j);
}



For those who are unfamiliar with the term long long int, let me tell you that it is used to hold bigger integer values i.e., up to 15 digits and uses 8 bytes of memory and %lld is the symbol used to use the values. If you face any problem, then do comment and we will be happy to serve you.

0 comments:

Post a Comment