Recursive factorial C++

//Recursive Factorial //Giame Carlos Fajardo Santos #include<iostream> using namespace std; int FunFactorial(int Num); main(){ int FacNum; system ("color f0"); cout<<"/////////////////////////\n"; cout<<"///Recursive Function////\n"; cout<<"/////////////////////////\n"; cout<<"///Type the numer:";cin>>FacNum; cout<<"/////////////////////////\n"; cout<<"///El Factorial Es:"<<FunFactorial(FacNum)<<"\n"; cout<<"/////////////////////////\n"; } int FunFactorial(int Num){ if(Num==0) return 1; else return Num*FunFactorial(Num-1); }
This snippet shows you how to obtein the factorial of a number by using a Recursive function

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.