Monday, May 24, 2010

To find factorial of number using c++?

i want a program which finds factorial upto first 1000 numbers in c++

To find factorial of number using c++?
Try... this cool website:





http://www.pixel2life.com





bye......................................
Reply:main()


{


int


for(i=1;i%26lt;=1000;i++)


{


fact=rec(i) ;


cout %26lt;%26lt; fact ;


}


getch() ;


}





rec( int x)


{


int f ;


if( x==1)


return(1) ;


else


{


f=x*rec(x-1) ;


return(f) ;


}


}








Understood the logic of the above program ?


No comments:

Post a Comment