Advertisement
Guest User

dupa

a guest
Nov 18th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.*;
  3. public class Program
  4.  
  5.  
  6. {
  7. public static void main(String [] args)
  8. {
  9. int wrt1, wrt2; double wrt3;
  10. /*Scanner konsola= new Scanner(System.in);
  11. wrt1=konsola.nextInt();
  12. wrt2=(int)(Math.random()*100);
  13. System.out.println(wrt2);
  14. System.out.println("wrt1*wrt2= "+wrt1*wrt2);
  15. *///wrt2=fibbonaci(wrt1);
  16. // System.out.println(wrt2);
  17. Scanner konsola= new Scanner(System.in);
  18. wrt1=konsola.nextInt();
  19. System.out.println(fibbonaci(wrt1));
  20.  
  21. }
  22. static int fibbonaci(int wrt)
  23. { System.out.println("fib "+wrt);
  24. if(wrt==1)
  25. {
  26. return 1;
  27. }
  28. else
  29. {if(wrt==2)
  30. return 1;
  31. else return (fibbonaci(wrt-1)+fibbonaci(wrt-2));
  32. }
  33.  
  34.  
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement