Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner s = new Scanner (System.in);
- System.out.print("Limit: ");
- int n = s.nextInt ();
- int first = 0;
- int second = 1;
- int sum;
- for (int i = 0; i < n-2; i++) {
- sum = first + second;
- System.out.println(first);
- System.out.println(sum);
- first = second;
- second = sum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement