.. www.engineerscur.blogspot.com: C language program to find factorial up to given number

C language program to find factorial up to given number

C language program to find factorial up to given number:


//factorial up to given no

#include<stdio.h>
#include<conio.h>
void main()
{
            int i,ans=1,no;
            clrscr();
            printf("Enter the number:");
            scanf("%d",&no);
            for (i=1;i<=no;i++)
            {
                        ans=ans*i;
            }
            printf("factorial up to given number is:%d",ans);
            getch();
}



Note:  Since i have used int datatype you will find factorial up to 8 only but you can modify program if you want to find factorial of big number just change datatype from int to long int or double.