public class Rekursif {
public static
void main(String[] args) {
System.out.println("Faktorial ");
int x=4;
System.out.println(x+"!");
System.out.println("hasil : "+faktorial(x));
System.out.println("---------------------------");
System.out.println("Auliya Rahmah 037 ^.^");
}
static int
faktorial(int x){
if(x==0){
return
1;
}else{
return
x*faktorial(x-1);
}
}
}
Download script Link1 / Link2
No comments:
Post a Comment