Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Scanner s = new Scanner (System.in);
  2.  
  3.  
  4. System.out.print("Limit: ");
  5.  
  6. int n = s.nextInt ();
  7.  
  8. int first = 0;
  9. int second = 1;
  10. int sum;
  11.  
  12.  
  13. for (int i = 0; i < n-2; i++) {
  14. sum = first + second;
  15. System.out.println(first);
  16. System.out.println(sum);
  17. first = second;
  18. second = sum;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement