class Fibonacci {
public static void main
(String[] args
) { int termo1 = 0;
int termo2 = 1; //se são dois termos, precisa de duas várias para controlar
do {
System.
out.
print(termo1
+ " "); //Está mandando imprimir um dos termos int temp = termo1 + termo2; //somando os dois últimos termos conforme o enunciado
termo1 = termo2; //fazendo o primeiro termo ter o valor do segundo
termo2 = temp; //fazendo o segundo termo ter o valor somado dos últimos termos
} while (termo1 <= 2584); //precisa de um laço para ficar repetindo até a condição
}
}
//https://pt.stackoverflow.com/q/254061/101
Y2xhc3MgRmlib25hY2NpIHsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKICAgICAgICBpbnQgdGVybW8xID0gMDsKICAgICAgICBpbnQgdGVybW8yID0gMTsgLy9zZSBzw6NvIGRvaXMgdGVybW9zLCBwcmVjaXNhIGRlIGR1YXMgdsOhcmlhcyBwYXJhIGNvbnRyb2xhcgogICAgICAgIGRvIHsKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludCh0ZXJtbzEgKyAiICIpOyAvL0VzdMOhIG1hbmRhbmRvIGltcHJpbWlyIHVtIGRvcyB0ZXJtb3MKICAgICAgICAgICAgaW50IHRlbXAgPSB0ZXJtbzEgKyB0ZXJtbzI7IC8vc29tYW5kbyBvcyBkb2lzIMO6bHRpbW9zIHRlcm1vcyBjb25mb3JtZSBvIGVudW5jaWFkbwogICAgICAgICAgICB0ZXJtbzEgPSB0ZXJtbzI7ICAvL2ZhemVuZG8gbyBwcmltZWlybyB0ZXJtbyB0ZXIgbyB2YWxvciBkbyBzZWd1bmRvCiAgICAgICAgICAgIHRlcm1vMiA9IHRlbXA7IC8vZmF6ZW5kbyBvIHNlZ3VuZG8gdGVybW8gdGVyIG8gdmFsb3Igc29tYWRvIGRvcyDDumx0aW1vcyB0ZXJtb3MKICAgICAgICB9IHdoaWxlICh0ZXJtbzEgPD0gMjU4NCk7IC8vcHJlY2lzYSBkZSB1bSBsYcOnbyBwYXJhIGZpY2FyIHJlcGV0aW5kbyBhdMOpIGEgY29uZGnDp8OjbwogICAgfQp9CgovL2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8yNTQwNjEvMTAx