package nilaifaktorial;
import java.io.*;
public class Main {
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);
}
}
Tidak ada komentar:
Posting Komentar