Advertisement
blackpab

Algorytmy 20171031 z1

Oct 31st, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. package fibobacii;
  2.  
  3. /**
  4. *
  5. * @author student
  6. */
  7. public class FiboBacii {
  8.  
  9. /**
  10. * @param args the command line arguments
  11. */
  12. public static void main(String[] args) {
  13. int[] tablica = new int[8];
  14. tablica[1] = 1;
  15. tablica[2] = 1;
  16.  
  17. for(int n=3; n<tablica.length; n++) {
  18. tablica[n] = tablica[n-2] + tablica[n-1];
  19. }
  20. System.out.println("Wynik to: " + tablica[tablica.length-1]);
  21. }
  22. }
  23. //5 nad 3 zrobic symbol newtona na tablicy 2 wymiarowej n=5 tyle kolumn, k=3, tyle wierszy // dwie petle itd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement