Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- //Main variables
- long variNull = 0l;
- long variEins = 1l;
- long variZwei = 0l;
- int i = 0;
- int x = 0;
- //goal, procid fib seq.
- /*
- 0, 1, 2
- 3, 5, 8
- 13, 21, 34
- */
- do {
- //math
- i++;
- variZwei = variNull + variEins;
- //prints the seq.
- System.out.println(variZwei);
- //changes variables
- switch(x)
- {
- case 0:
- x++;
- variNull = variZwei;
- break;
- case 1:
- x--;
- variEins = variZwei;
- break;
- }
- } while (i < 45);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement