Clock

Selasa, 10 Juni 2014

Faktorial

demo template blog and download free blogger template feature like magazine style, ads ready and seo friendly template blog
Coding Faktorial

#include <cstdlib>
#include <iostream>

using namespace std;

    long int fakto(unsigned int nil_n){
    if(nil_n == 0|| nil_n == 1)
       return 1;
   else
       return nil_n*fakto(nil_n-1);
}

int main(int argc, char *argv[])
{
    int n;
   cout<<"Inputkan nilai n = ";cin>>n;
   long int hasil = fakto(n);
   cout<<n<<"! = "<<hasil;
   cout<<endl;
    system("PAUSE");
    return EXIT_SUCCESS;
}

screenshot


0 komentar:

Posting Komentar