faktorial.java


public class faktorial
{
public static void main(String[] args)
{
int f,n;
String faktorial;
f = 5;
n = f-1;
faktorial = f + “! = 5”;
for ( int i = n; i >= 1 ; i– )
{
f = f * i;
faktorial = faktorial + “.” + i;
}
faktorial = faktorial + ” = ” + f;
System.out.println(faktorial);
}
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s