Friday, 26 August 2016

Factorial of a Number

Factorial of a Number

#include <stdio.h>
int main()
{
    int n, i;
    unsigned int f = 1;

    printf("Enter an integer: ");
    scanf("%d",&n);

        for(i=1; i<=n; ++i)
        {
            f= f*i;             
        }
        printf("Factorial of %d = %d", n, f);
   

    return 0;

}

0 comments:

Post a Comment

if you have any doubt please let me know