CLICK HERE FOR FREE BLOGGER TEMPLATES, LINK BUTTONS AND MORE! »
Daisypath Wedding tickers

Sunday, October 25, 2009

Java : Program Bilangan Faktorial




import java.io.*;
class BilFaktorial
{
public static void main(String[] args)throws Exception
{
String n;
int f=1,n1;
InputStreamReader key= new InputStreamReader (System.in);
BufferedReader input= new BufferedReader (key);

System.out.println("Menghitung Nilai Faktorial");
System.out.print("Masukan Angka = ");

n=input.readLine();
n1=Integer.parseInt(n);

for (int i=1;i<=n1;i++)f*=i;
System.out.println("Nilai Dari " +n+ "! Adalah:"+f);

}
}

1 comment: