import java.io.*; public class FaktorialRekursif{ public static void main(String[] trs) throws Exception{ BufferedReader qwer = new BufferedReader (new InputStreamReader(System.in)); int a,b; System.out.print ("Inputkan Bilangan = "); a = Integer.parseInt(qwer.readLine()); System.out.println(a+"!"); tampilkan(a); System.out.println(""); System.out.println("hasil = "+(faktorial(a))); } static void tampilkan (int a){ for (int i=a-1; i>0; i--){ for (int j=a; j>=i; j--){ System.out.print (j); if (j==i) System.out.print (""); else System.out.print (" x ");} System.out.println ("");} } static int faktorial(int a){ if (a==0) return(1); else return(a*faktor(a-1)); } }
membuat program faktorial rekursif sengan java
January 18, 2014
Bobby Syahronanda
mantab banget gan
ReplyDeleteSolder uap portable