Praktikum Madis ke 5

#include <cstdlib>
#include <iostream>

using namespace std;
long int Fak_Rekursif(int N){
long int F;
if(N<=1)
return(N);
else
{
F=N*Fak_Rekursif(N-1);

return (F);
}
}
int main(int argc, char *argv[])
{
int N;
/*int F=1;
cout<<“Masukkan bilangan yang akan difaktorialkan : “;
cin>>N;
if (N<=1)
F=N*(N-1);
//*/cout<<“Masukkan bilangan : “;
cin>>N;
printf(“%d Faktorial = %d\n”,N,Fak_Rekursif(N));

system(“PAUSE”);
return EXIT_SUCCESS;
}

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s