#include <cstdlib>
#include <iostream>
using namespace std;
int faktorial(int a){
int hasil=1;
for(int i=1; i<=a; i++){
hasil*=i;
}
return hasil;
}
int main(int argc, char *argv[]){
int e;
cout<<"Masukan bil yang akan faktorial kan : ";
cin>>e;
cout<<e<<"! = "<<faktorial(e)<<endl;
system("PAUSE");
return EXIT_SUCCESS;}
tugas DDP "faktorial"
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment