#include <conio.h>
#include <iostream.h>
#pragma argsused
int main()
{
int i,x,f,k,hasil;
cout<<"FAKTORIAL BILANGAN"<<endl;
cout<<"------------------"<<endl;
cout<<endl;
cout<<"Masukkan jumlah faktorial : "; cin>>x;
cout<<endl;
for(i=1;i<=x-1;i++)
{
cout<<i<<"! : ";
hasil=1;
for(f=1;f<=i;f++)
{
k=f;
hasil=hasil*k;
}
cout<<hasil;
cout<<endl;
}
cout<<"--------------------------"<<endl;
cout<<i<<"! : ";
for(i=1;i<=x;i++)
{
cout<<i<<" * ";
}
cout<<endl;
for(i=1;i<=x;i++)
{
hasil=1;
for(f=1;f<=i;f++)
{
k=f;
hasil=hasil*k;
}
}
i=x;
cout<<i<<"! : "<<hasil;
getch();
}
0 comments:
Post a Comment