Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- //Ini adalah Fungsi-nya
- using namespace std;
- float factorial(float n)
- {
- if(n>1)
- return n*factorial(n-1);
- else
- return 1;
- }
- main()
- {
- float fac,n;
- //title
- cout<<"\t\t$-----------------------------------$"<<endl;
- cout<<"\t\t|CONTOH PROGRAM CALCULATOR FAKTORIAL|"<<endl;
- cout<<"\t\t| by : ageung hidayat |"<<endl;
- cout<<"\t\t$-------$-------*****-------$-------$"<<endl;
- cout<<"\nMasukkan Angka: ";
- cin>>n;
- //output
- cout<<"Faktorial dari "<<n<<" adalah "<<factorial(n)<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement