Martin Sarlina
#include <cstdlib>
#include <iostream>
using namespace std;
int factorial(int f){
int hasil=1;
for(int i=1; i<=f; i++){
hasil*=i;
}
return hasil;
}
int main(int argc, char *argv[]){
int x;
cout<<"Masukan bilangan yang akan di factorial : ";
cin>>x;
cout<<x<<"! = "<<factorial(x)<<endl;
system("PAUSE");
return EXIT_SUCCESS;}
#include <iostream>
using namespace std;
int factorial(int f){
int hasil=1;
for(int i=1; i<=f; i++){
hasil*=i;
}
return hasil;
}
int main(int argc, char *argv[]){
int x;
cout<<"Masukan bilangan yang akan di factorial : ";
cin>>x;
cout<<x<<"! = "<<factorial(x)<<endl;
system("PAUSE");
return EXIT_SUCCESS;}
Martin Sarlina
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char nama[10];
char kelas;
int nim;
cout<<"masukkan nama:"<<endl;
cin>>nama;
cout<<"kelas:"<<endl;
cin>>kelas;
cout<<"nim:"<<endl;
cin>>nim;
system("PAUSE");
return EXIT_SUCCESS;
}