/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rekursipangkat;
/**
*
* @author andi m
*/
class Rekursi{
int Pangkat(int a,int b){
if(b==0){
return 1;
}
else
return (a*Pangkat(a,b-1));
}
}
public class RekursiPangkat {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Rekursi pangkat=new Rekursi();
System.out.println(+pangkat.Pangkat(2, 4));
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rekursipangkat;
/**
*
* @author andi m
*/
class Rekursi{
int Pangkat(int a,int b){
if(b==0){
return 1;
}
else
return (a*Pangkat(a,b-1));
}
}
public class RekursiPangkat {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Rekursi pangkat=new Rekursi();
System.out.println(+pangkat.Pangkat(2, 4));
}
}
No comments