/**
*
* @author Ilham Yuliantoro(10509060011029)
*/
import java.util.Scanner;
public class Fibonacci {
public static void main(String[]args){
Scanner masukan=new Scanner(System.in);
int a=1,b=1;
System.out.println("PROGRAM DERET FIBONACCI");
System.out.println("");
System.out.print("Masukan bilangan sebagai jumlah deret fibonacci :");
int bilangan=masukan.nextInt();
System.out.print(a+",");
for (int i=1;i
System.out.print(a+",");}
else{
System.out.print(a+" ");}
a=a+b;
b=a-b;
}
System.out.println();
}
}
0 komentar:
Posting Komentar