Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1.  
  2. public class fib {
  3.     public static void main(String[] args)
  4.     {
  5.         int num1 = 0;
  6.         int num2 = 1;
  7.         System.out.print(num1 + "," + num2 + ",");
  8.         for(int i = 0; i < 100; i++) //change the 100 to whatever amount of numbers you want to print
  9.         {
  10.             System.out.print(num1+num2 + ",");
  11.             int temp = num1;
  12.             num1 = num2;
  13.             num2 = temp+num2;
  14.         }
  15.     }
  16. }
  17.  
  18. PR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement