C - A2P2 -Find the Factorial of given number







/* Write a Programe to find the factorial of given number */

#include<stdio.h>
#include<conio.h>
void main()
{
    int fact=1,a,no;
    clrscr();
    printf("Enter Number ->");
    scanf("%d",&no);
    a=no-1;
    fact=no;

    while(a>0)
    {
        fact=fact*a;
        a--;
    }
    printf("\n\nFactorial - > %d",fact);
    getch();
}

Post a Comment