Thursday, April 25, 2013

Factorial in c

Write a program in c to find the factorial of a number 



#include<stdio.h>
#include<conio.h>
main()
{
    int i,sum=1,num;
    printf("\n\tIT'S A PROGRAM TO FIND THE FACTORIAL OF A NUMBER:");
    printf("\n\nEnter the number:");
    scanf("%d",&num);
    for(i=1;i<=num;i++)
    {
        sum*=i;

    }
    printf("\nFactorial value of %d is:",num);
    printf("%d\n",sum);
    }

No comments:

Post a Comment