Kali ini Program Penghitung Faktorial ...
Let's get the code !
#include
using namespace std;
double fact(double n);
int main()
{
int n;
cout << "###################################n";
cout << "### STT-PLN 2011 ###n";
cout << "### Faktorial Solver ###n";
cout << "### Danang Adhi Prasetya ###n";
cout << "###################################n";
cout << " Masukkan angka: ";
cin >> n;
cout << "n";
cout << n << "!=";
cout << fact(n) << endl;
return 0;
}
double fact(double n)
{
if (n>1) return n*fact(n-1);
else return 1;
}
0 Komentar