Sabtu, 09 April 2016

factorial #kasus 5.5

KASUS 5.5  

SILAHKAN MENCOBA PROGRAM DI BAWAH INI:

#include <string>

using namespace std;
void factorial(int n,int x,int hasil){
 if(x>n){
  cout<<"Factorial "<<n<<" adalah "<<hasil<<endl;
 }
else{
 hasil=hasil*x;
 x=x+1;
 factorial(n,x,hasil);
}
}

int main() {
 int hasil;
 int n;
 int x;
 cout<<"Masukan nilai factorial : ";
 cin>>n;
 x=1;
 hasil=1;
 factorial(n,x,hasil);
  return 0;
}

RAPTOR

Unknown

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 komentar:

Posting Komentar