Kodingan Fibonnacii :
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package fibonacci;
/**
*
* @author SystemFive
*/
public class Fibonacci {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int temp,start_angka,angka,counter,start_counter;
angka = 1;
start_angka = 0;
counter = 10;
for(start_counter = 1; start_counter <= counter; start_counter++)
{
temp = angka + start_angka;
angka = start_angka;
start_angka = temp;
System.out.print(temp+",");
}
}
}
Jika sudah selesai run melalaui IDE favorit kalian atau bisa run via CMD : java -jar <tempat_filejar>
EmoticonEmoticon