Catatn Minggu 3

Rekursif fungsi faktorial

int fakt(int n){
if(n==1)return 1;
else return n*fakt(n-1);
}

prosedur yang tdk ada nilai pengembalian

void cetak(int n){
if(n>=1){
cetak(n-1);
cout<<"i = "<<n;
} }

prosedur pada array

void cetak (int a[],int n){
if(n>=1){
cetak(a,n-1);
cout<<" A [ "<<n<<"]= "<<a[n];
} }

model inputan

void cetaklah(int n){
cout<<"masukan nilai n=";cin>>n;
if(n>=1){
cout<<n;
else
cetaklah(n-1);
}

Share this:

ABOUT THE AUTHOR

Hello We are OddThemes, Our name came from the fact that we are UNIQUE. We specialize in designing premium looking fully customizable highly responsive blogger templates. We at OddThemes do carry a philosophy that: Nothing Is Impossible

0 komentar:

Posting Komentar