My photo
Bangalore, Karnataka, India
Extending one hand to help someone has more value rather than joining two hands for prayer

Archives

Program to find the factorial of a large number

Thursday, September 10, 2009

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num,i,k,a[200],temp,index,n,x,test;
cout<<"enter the no. of test cases";
cin>>test;
while(test>0)
{
cout<<endl<<"enter the number ";
cin>>num;
k=num;
for(i=0;k>=1;i++)
{
  a[i]=k%10;
  k=k/10;
    }


   for(n=1;n<num;n++)
   {
   temp=0;

      for(index=0;index<i;index++)
      {
            x=a[index]*n+temp;
            a[index]=x%10;
            temp=x/10;
            }

            while(temp!=0)
            {
               a[index]=temp%10;
               temp=temp/10;
               index++;
               i++;
                 }
}
for(i=index-1;i>=0;i--)
cout<<a[i];
test--;}
clrscr();
cout<<"made by anil";

        getch();



        }

2 comments:

Tameen kaur said...

I m a second year student of computer science. All the programs are amazing but their is no tutioral or artical on theory in your website

Upinder Singh Dhami said...

Our team is working in articles. We will post it as soon as possible. Keep on visiting....