Monday, December 30, 2013

/*C program to compute d factorial of a given no.*/

#include<stdio.h>
#include<conio.h>
void main()
{
    int i,N,fact=1;
    clrscr();
    printf("Enter the no.\n");
    scanf("%d",&N);
    if(N<=0)
    {
        fact=1;
    }
    for(i=1;i<=N;i++)
    {
        fact=fact*i;
    }
    printf("the result is=%d\n",fact);
}

No comments:

Post a Comment