import javax.swing.*;
public class fibonacci{
public static void main(String[] args) {
int a=0;
int b=1;
int n=Integer.parseInt(JOptionPane.showInputDialog(null,"Masukan Jumlah Pengulangan : ",".:: Angka Fibonacci ::.",JOptionPane.QUESTION_MESSAGE));
System.out.println("Pengulangan Sebanyak : " +n+" Kali\n");
for(int i=0; i < n; i++){
System.out.print(" " + a);
a=a+b;
b=a-b;
}
System.out.println("\n");
}
}
Rabu, 11 Juni 2014
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar