PROGRAM :
package tugasmatrix;
/**
*
* @author Serly
*/
import java.io.*;
public class faktorisasi {
public static void main(String[] args)throws Exception{
InputStreamReader key = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(key);
String n;
int i,j,k=1;
System.out.print("Masukkan Nilai untuk di faktorialkan = ");
n=input.readLine();
j=Integer.parseInt(n);
System.out.print(j +" "+"!=");
for(i=j;i>=1;i--){
System.out.print(i);
if(i>1)
System.out.print("x");
k=k*i;
}
System.out.print("\n");
System.out.println(j+ " " +"!="+" "+k);
}
}
OUTPUT :
sudah bagus, namun lebih baik dikasih penjelasan lebih detail agar kita bsa lbh faham. thx
BalasHapusMakasih Ea Saranx....
Hapus