Skip to content

Instantly share code, notes, and snippets.

@ericksprengel
Created September 20, 2016 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericksprengel/73c77ea60aa665b89b8890db08803366 to your computer and use it in GitHub Desktop.
Save ericksprengel/73c77ea60aa665b89b8890db08803366 to your computer and use it in GitHub Desktop.
Aula Java - A01E01 - Fibonacci
class JavaA01E01Fibonacci {
public static void main(String[] args) {
// Reference: https://pt.wikipedia.org/wiki/Sequ%C3%AAncia_de_Fibonacci
int f0 = 0;
int f1 = 1;
int aux;
System.out.println("0: " + f0);
System.out.println("1: " + f1);
for(int i = 2; i < 20; i++) {
aux = f0;
f0 = f1;
f1 = f1 + aux;
System.out.println(i + ": " + f1);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment