#include <iostream>
using namespace std;
int faktorial(int n) {
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<<"Masukkan nilai= ";
cin>> n ;
cout<< faktorial(n) ;
system("PAUSE");
return EXIT_SUCCESS;
}
for (i=n; i>1; --i) {
product=product*i;
}
return product;
}
int main(int argc, char *argv[])
{
int n;
cout<<"Masukkan nilai= ";
cin>> n ;
cout<< faktorial(n) ;
system("PAUSE");
return EXIT_SUCCESS;
}
-BAHASA C++ RUN
Tidak ada komentar:
Posting Komentar