#include <cstdlib>
#include <iostream>
using namespace std;
int faktorial (int n){
int i, product=1;
for (i=n; i>1; --i){
product=product*i;
}
return product;
}
int main(int argc, char *argv[])
{
int n;
cout<<"Inputkan Nilai : ";
cin>>n;
cout<<"Faktorial : " <<faktorial(n)<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
c++ :
0 komentar:
Posting Komentar