# data[].attributes.body
#include <iostream.h>

int Kuasa (int,int);
int main ()
{

int X, Y, nilai;
cin >> X ;
cin >> Y;
nilai = Kuasa(X,Y);
cout<< nilai;

return 0;
}

int Kuasa( int x, int y)
{
if (y==0)
return 1;
else
if (y==1)
return x;
else
return (x *Kuasa(x, y-1));
}

# data[].attributes.body
#include < iostream.h>

int kuasa(int x,int y);
main ()
{
int x;
int y;
int kuasa;

cin >>x;
cin >>y;
nilai = kuasa(int x,int y);
cout<<nilai;
return 0;

}
int kuasa ((int x,int y)
{
if y==0
return 1;

else
if y==1
return x;

else
return (x * kuasa (x,y-1));
}

# data[].attributes.body
#include<iostream.h>

int main()

{

int x, y, ackermann;

cout<<"nilai m:";

cin>>x;

cout<<"nilai n:";

cin>>y;

ackermann=F(x,y);

cout<<ackermann;

cin>>x>>y;

}

intF(int m, int n)

{

if(m==0)

return n+1;

else if (n==0)

return F(m-1,1);

}

else return (F(m-1,F(m,n-1);

}

# data[].attributes.body
#include<iostream>
using namespace std;

int F(int, int);

void main(){

int x, y, ackermann;
cout<<"nilai m";
cin>>x;
cout<<"nilai n";
cin>>y;
ackermann = F(x, y);
cout <<ackermann;
}

int F(int m, int n){
if (m==0)
return n+1;
else if (n==0)
return F(m-1, 1);
else return (F(m-1, F(m, n-1)));
}

# data[].attributes.body
#include<iostream.h>

int main()

{

int x, y, ackermann;

cout<<"nilai m:";

cin>>x;

cout<<"nilai n:";

cin>>y;

ackermann=F(x,y);

cout<<ackermann;

cin>>x>>y;

}

intF(int m, int n)

{

if(m==0)

return n+1;

else if (n==0)

return F(m-1,1);

}

else return (F(m-1,F(m,n-1);

}

# data[].attributes.body
d20142069418

# data[].attributes.body
d2014206971

#include<iostream>
using namespace std;

int F(int, int);

void main(){

int x, y, ackermann;
cout<<"nilai m";
cin>>x;
cout<<"nilai n";
cin>>y;
ackermann = F(x, y);
cout <<ackermann;
}

int F(int m, int n){
if (m==0)
return n+1;
else if (n==0)
return F(m-1, 1);
else return (F(m-1, F(m, n-1)));
}

# data[].attributes.body
D069413

# data[].attributes.body
d20142069427

F(0,n) = n+1
F(m, 0) = F(m-1,1)
F(m,n) = F(m-1, F(m, n-1))

m = 2, n= 1

#include<iostream>
using namespace std;

int F(int, int);

void main(){

int x, y, ackermann;
cout<<"nilai m";
cin>>x;
cout<<"nilai n";
cin>>y;
ackermann = F(x, y);
cout <<ackermann;
}

int F(int m, int n){
if (m==0)
return n+1;
else if (n==0)
return F(m-1, 1);
else return (F(m-1, F(m, n-1)));
}

# data[].attributes.body
D20142069411

# data[].attributes.body
#include<iostream>

using namespace std;

int main()

{

int x, y, ackermann;

ackermann=F(x,y);

cout<<ackermann;

}

intF(int m, int n)

{

if (m==0)

return n+1;

else if (n==0)

return F(m-1,1);

else return (F(m-1,F(m,n-1));

}

# data[].attributes.body
D20142068694

F(0,n) = n+1
F(m, 0) = F(m-1,1)
F(m,n) = F(m-1, F(m, n-1))

int main()

{

m = 2, n= 1

int F (int, int );
int main()

{
int x, y, ackermann;
ackermann = F(x, y);
cout <<ackermann;
}

int F(int m, int n)

{
if (m==0)
return n+1;
else if (n==0)
return F(m-1, 1)};

else return (F(m-1, F(m, n- 1)));

}

# data[].attributes.body
F(0,n) = n+1
F(m, 0) = F(m-1,1)
F(m,n) = F(m-1, F(m, n-1))

m = 2, n= 1

int x,y, ackermann;

cout<<"value m:";

cin>>x;

cout<<"value n:";

cin>>y;

ackermann = F(x, y);
cout <<ackermann;
}

int F(int m, int n){
if (m==0)
return n+1;
else if (n==0)
return F(m-1, 1);
else return (F(m-1, F(m, n-1)));
}

# data[].attributes.body
#include <iostream.h>

int main()

{

{

int x, y, ackermann;

cin>>x>>y;

ackermann=F(x,y);

cout<<ackermann;

}

int F(int m, int n);

{

if (m==0)

return n+1;

else if (n==0)

return F(m-1,1)

};

else return (F(m-1),F(m,n-1));

}

# data[].attributes.body
F(0,n)=n+1

F(m,0)=F(m-1,1)

F(m,n)=F(m-1,F(m,n-1))

m=2,n=1
#include<iostream> using namespace std; int F(int,int); main() { int x, y, ackermann; cout<<"X:"; cin>>x; cout<<"Y:"; cin>>y; ackermann=F(x,y); cout<<ackermann; } intF(int m, int n) { if (m==0) return n+1; else if (n==0) return F(m-1,1); else return (F(m-1,F(m,n-1)));
}

# data[].attributes.body
D20142068689

F(0,n)=n+1

F(m,0)+F(m,n-1))

m=2,n=1

int F(int,int);

int main()

int x,y,ackermann;

ackermann=F(x,y);

cout<<"nilai m";

cin>>x;

cout<<"nilai n";

cin>>n;

ackermann=F(x,y);

cout<<ackermann;

}

int F(int m,int n){

if(m==0)

return n+1;

else if (n==0)

returnF(m-1,1);

else return(F(m-1,F(m,n-1)));

}

# data[].attributes.body
f(0,n)=n+1

f(m,0)=f(m-1, 1)

f(m,n)=f(m-1, f(m, n-1))

m=2, n=1

int f(int,int);

int main()

{

int x;

int y;

int ackermann;

cout<<"masukkan nilai m";

cin>>x;

cout<<masukkan nilai n";

cin>>y;

ackermann=f(x,y);

cout<<ackermann;

}

int f(int m, int n)

{

if (m==0)

return n+1;

else if (n==0)

return f(m-1, 1);

else

return (f(m-1, f(m, n-1)));

}

# data[].attributes.body
#include<iostream.h>

int main()

{

int x, y, ackermann;

cout<<"nilai m:";

cin>>x;

cout<<"nilai n:";

cin>>y;

ackermann=F(x,y);

cout<<ackermann;

cin>>x>>y;

}

intF(int m, int n)

{

if(m==0)

return n+1;

else if (n==0)

return F(m-1,1);

}

else return (F(m-1,F(m,n-1);

}

# data[].attributes.body
rekursif

2bahagian

I-memanggil diri sendiri(utk berulang)

II-base case(kes asas) utk berhenti

# data[].attributes.body
#include<iostream.h>

int main()

{

int x, y, ackermann;

cout<<"nilai m:";

cin>>x;

cout<<"nilai n:";

cin>>y;

ackermann=F(x,y);

cout<<ackermann;

cin>>x>>y;

}

intF(int m, int n)

{

if(m==0)

return n+1;

else if (n==0)

return F(m-1,1);

}

else return (F(m-1,F(m,n-1);

}

# data[].attributes.body
d069417

include<iostream.h>

void main()

int x,y,ackermann;

ackermann F=(x,y);

cout<<ackermann;

cout<<"nilai x";

cin>>x;

cout<<"nilai y";

cin>>y

}

intF(int m, int n)

{

if (m==0)

return n+1;

else if (n==0)

return F(m-1,1);

else return (F(m-1,F(m,n-1));

}

# data[].attributes.body
d067987

# data[].attributes.body
#include<iostream.h>

int F(int, int);

void main()

{

int x, y, ackermann;
cout<<"nilai m";
cin>>x;
cout<<"nilai n";
cin>>y;
ackermann = F(x, y);
cout <<ackermann;
}

int F(int m, int n)

{
if (m==0)
return n+1;
else if (n==0)
return F(m-1, 1);
else return (F(m-1, F(m, n-1)));
}

# data[].attributes.body
d20142069421

include<iostream.h>

void main()

int x,y,ackermann;

ackermann F=(x,y);

cout<<ackermann;

cout<<"nilai x";

cin>>x;

cout<<"nilai y";

cin>>y

}

intF(int m, int n)

{

if (m==0)

return n+1;

else if (n==0)

return F(m-1,1);

else return (F(m-1,F(m,n-1));

}

# data[].attributes.body
d20142069412

# data[].attributes.body
d069424

# data[].attributes.body
d067988

# data[].attributes.body
D20142068688
tracing calculation sahaja

1.F(0,n) = n+1
2.F(m, 0) = F(m-1,1)
3.F(m,n) = F(m-1, F(m, n-1))

m = 2, n= 1

f(m,n)
A.use no.3
f(2,1)=f(m-1,f(m,n-1))
=f(2-1,f(2,1-1))
=f(1,f(2,0))

f(2,0)=f(m,0)
B.use no2
f(2,0)=f(m-1,1)
=f(1,1)
C.use no.3
F(1,1)=f(1-1,f(1,1-1))
=f(0,f(1,0))

f(1,0)=f(m,0)
D.use no2
f(1,0)=f(1-1,1)
=f(0,1)

f(0,1)=f(0,n)

E.use no1
f(0,1)=n+1
=2

From C

f(0,f(1,0))=f(0,2)

use no1
f(0,2)=n+1
=3
from A f(2,0)=3
from A f(1,f(2,0))=f(1,3)

F(1,3)=f(m,n)
no3
=f(0,f(1,2))
=f(0,f(0,f(1,1)))
=f(0,f(0,2))
=f(0,3)
=f(0,4)
=5.....
huu habis pon...

Programing

#include<iostream.h> int F(int,int);
main() { int x, y, ackermann; cout<<"X:"; cin>>x; cout<<"Y:"; cin>>y; ackermann=F(x,y); cout<<ackermann; }
intF(int m, int n) { if (m==0) return n+1; else if (n==0) return F(m-1,1); else return (F(m-1,F(m,n-1)));
}

# data[].attributes.body
D048824

# data[].attributes.body
main(){

int x, nilai Fib;

cin>>x;

nilai Fib=Fib(x);

cout<<nilai Fib;

}

int Fib(int n){

if n==0||n==1

return 1;

else

return (Fib(n-1)+ Fib(n-2)

}

# data[].attributes.body
main

# data[].attributes.body
include<iostream>

using namespace std;

int main ()

int x,y,ackerman;

ackerman = F

# data[].attributes.body
F(0,n) = n+1
F(m, 0) = F(m-1,1)
F(m,n) = F(m-1, F(m, n-1))

m = 2, n= 1

#include<iostream>

using namespace std;

int F ( int,int );

int main()

{
int x, y, ackermann;

cout<< "X?";

cin>> x;

cout<<"Y?";

cin>>y;
ackermann = F(x, y);
cout <<ackermann;

}

int F(int m, int n){
if (m==0)
return n+1;
else if (n==0)
return F(m-1, 1)};
else return (F(m-1, F(m, n-1)));

}

# data[].attributes.body
F(0,n) = n+1
F(m, 0) = F(m-1,1)
F(m,n) = F(m-1, F(m, n-1))

m = 2, n= 1

#include<iostream>
using namespace std;

int F(int, int);

void main(){

int x, y, ackermann;
cout<<"nilai m";
cin>>x;
cout<<"nilai n";
cin>>y;
ackermann = F(x, y);
cout <<ackermann;
}

int F(int m, int n){
if (m==0)
return n+1;
else if (n==0)
return F(m-1, 1);
else return (F(m-1, F(m, n-1)));
}

# data[].attributes.body
main(){

int x,y,nilai kuasa

cin>>m>>n;

nilai kuasa= kuasa(x,y);

}

int kuasa( int m, int n){

if n==0,

return 1;

else

return (m*kuasa(m,n-1));

}

# data[].attributes.body
- definisi rekursif

- membezakan antara rekursif dengan lelaran

- membuina fungsi rekursif

- tracing fungsi rekursif

- aplikasi rekursif

Antara aplikasi rekursif ialah kuasa, siri fibbonachi, ackermann's, Palindrome, GCD, Tower of Hanoi, mencari no terbesar dan terkecil