ar_one_to. Diberdayakan oleh Blogger.
RSS

factorial


factorial
Numbers factorial is the multiplication of positive integers less than or equal to n. Factorial is usually written with n! and usually called n factorial. Factorial Numbers eg 4!, that means 4 x 3 x 2 x 1.
sample number factorial program C + +:
#include

long int faktorial(int a)
{
if (a==0 || a==1)
return 1;

else
return a*faktorial(a-1);
}

int main()
{
int bil, a,x;
long int jumlah;
cout<<"Masukkan bilangan a = ";
 cin>>a;
jumlah = faktorial(a);
cout<<<"!="jumlah;
cin>>x;
return 0;
}

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS