import java.io.*;
public class FaktorialWhile{
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;
while(a > 0)
{
hasil = hasil*a;
a--;
}
System.out.print(hasil);
}
}
membuat faktorial dengan perulangan while pada java
January 18, 2014
Bobby Syahronanda
0 Comments