fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static int pows(int n){
  11. if(n == 1 || n==2){
  12. return 1;
  13. }
  14. return (pows(n - 1) + pows(n - 2));
  15. }
  16. public static void main (String[] args)
  17. {
  18. int n, i = 0;
  19. Scanner S = new Scanner (System.in);
  20. n = S.nextInt();
  21. System.out.print(pows(n));
  22.  
  23. }
  24. }
Success #stdin #stdout 0.1s 35512KB
stdin
5
stdout
5