jump to navigation

Bilangan Faktorial December 1, 2011

Posted by kelompok24itbseamolecb5 in Algoritma dan Struktur Data.
trackback

Salah satu tugas hari kedua yaitu

Bilangan Faktorial…….

Algoritma Bilangan Faktorial… :

Judul : Algoritma Bilangan Faktorial

Kamus data:

int ← i,j,k,l=1

Deskripsi :

Input (Masukkan Bilangan Bulat :    )

for(k ← j;k>=1; k–)

if(k>1)

print (k+ ” * “)

else

print(k+” = “)

endif

for (i ← j;i>=1; i–)
l ← l* i

Print l

endfor

endfor

Source Code Bilangan Faktorial :

import java.util.*;
public class Faktorial {
public static void main (String [] args){
int i,j,k,l=1;
Scanner bil=new Scanner (System.in);
System.out.print(“Masukkan angka : “);
j=bil.nextInt();
for(k=j;k>=1;k–){
if(k>1){
System.out.print(k+” * “);
}else{
System.out.print(k+” = “);

}
}
for (i=j;i>=1;i–){
l=l*i;
}
System.out.println(l);
}

}

 

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: