Minggu, 18 April 2010

Java for

class For{

public static void main(String[] args) {
int fak = 5;
int i;
int hasil = 1;

for(i=2;i<=fak;i++){
hasil = hasil * i;
System.out.println("nilai variabel penghitung : " + i);
}

System.out.println("hasil faktorial : " + hasil);
}
}