public static void main(String [] args){
dt e=new dt();
e.d=10;
e.Deret();
}}
class dt{
int d,a;
for(a=1;a
if(a==1)
System.out.print(a);
else
System.out.print(",");
a=a+1;
}
}
}
public static void main(String [] args){
dt e=new dt();
e.Deret();
}}
class dt{
int SK=10; //sampai suku ke 10
int x=0,y=0,z=0;
void Deret(){
for(int i=1;i<=SK;i++){ //perintah looping sampai suku ke 10
if(a < i && i==1)
{
System.out.print(i);
x=i;
}
if(y < x)
{
z=x+y;
System.out.print(", "+z);
y=z;//perubahan nilai y
}
if(i>2)
{
z=x+y;
System.out.print(", "+z);
x=y; //perbarui nilai x
y=z; //perbarui nilai y
}
}
}
}