public
class Array
{
public static void
main(String[]args)
{
int a=1, b=1;
int n = 5; // input deret fibonacci
System.out.print(a+"
");
for (int i=1; i<n;
i++) // menggunakan perulangan for
{
System.out.print(a+"
");
a= a+b;
b= a-b;
}
System.out.println();
}
}
No comments:
Post a Comment