import java.io.*; public class FaktorialFor{ public static void main(String [] arg) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("inputkan nilai ="); String x = br.readLine(); int a = Integer.parseInt(x); long hasil = 1; for(int i=a; i>0; i--) { hasil = hasil*a; a=a-1; } System.out.print(hasil); } }
membuat faktorial for dengan java
January 18, 2014
Bobby Syahronanda
0 Comments