TUGAS ALGORITMA
FAKTORIAL
DISUSUN OLEH :
NAMA : SITI MUTMAINAH
NIM : 12.12.0319
KELAS : SI 12 F
STMIK AMIKOM PURWOKERTO
TAHUN AJARAN 2012/2013
LISTING PROGRAM
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package faktorial.pkg5;
/**
*
* @author mumu
*/
public class Faktorial 5 {
/**
* @param args the command line arguments
*/
static void faktorial(int i) {
int hasil = 1;
for (int j = i; j > 0; j--) {
if (j == 1) {
System.out.print(j + " = ");
} else {
System.out.print(j + " * ");
}
hasil = hasil * j;
}
System.out.println(hasil);
}
public static void main(String[] args) {
// TODO code application logic here
faktorial(5);
}
}
PRINTSCREEN PROGRAM

Tugas algoritma faktorial

  • 1.
    TUGAS ALGORITMA FAKTORIAL DISUSUN OLEH: NAMA : SITI MUTMAINAH NIM : 12.12.0319 KELAS : SI 12 F STMIK AMIKOM PURWOKERTO TAHUN AJARAN 2012/2013
  • 2.
    LISTING PROGRAM /* * Tochange this template, choose Tools | Templates * and open the template in the editor. */ package faktorial.pkg5; /** * * @author mumu */ public class Faktorial 5 { /** * @param args the command line arguments */ static void faktorial(int i) { int hasil = 1; for (int j = i; j > 0; j--) { if (j == 1) { System.out.print(j + " = "); } else { System.out.print(j + " * "); } hasil = hasil * j; } System.out.println(hasil); }
  • 3.
    public static voidmain(String[] args) { // TODO code application logic here faktorial(5); } } PRINTSCREEN PROGRAM