#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
void factorial (int n, int x, int hasil){
if(x>n)
{
cout<<"Factorial "<<n<<" adalah "<<hasil<<endl; }
else
{
hasil=hasil*x;
x=x+1;
factorial(n,x,hasil);
}
}
int main(int argc, char** argv) {
int hasil;
int n;
int x;
cout<<"Masukkan nilai factorial : ";
cin>>n;
x=1;
hasil=1;
factorial(n,x,hasil);
return 0;
}
2.Raptor :
0 komentar:
Posting Komentar