borsha06

Untitled

Apr 21st, 2021
722
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Arrays;
  2.  
  3. public class Fibonacci {
  4.  
  5.     // implement here
  6.    
  7.     static int[] fiboSum(int i, int j, int n)
  8.     {
  9.     int[] arr = new int[20];
  10.     arr[0] = i;
  11.     arr[1] = j;
  12.  
  13.     for(int k = 2; k<n; k++)
  14.     {
  15.         arr[k] = arr[k-1]+arr[k-2];
  16.        
  17.     }
  18.     return arr;
  19.    
  20.     }
  21.         public static void main(String args[])
  22.     {
  23.         System.out.println(Arrays.toString(Fibonacci.fiboSum(2, 4, 6)));
  24.        
  25.     }
  26.  
  27. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×