Hello All,
I have written following java program using recursion.It is working however it is not giving me ouput for value more than 45..
I want to find answer for value 50.
Please help.
------------------------
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner in =new Scanner(System.in); System.out.println("Enter number"); int n = in.nextInt(); System.out.println(Mymethod(n)); } public static long Mymethod(long n){ if(n==0){ return 0; } else if(n==1){ return 1; } else if(n==2){ return 1; } else{ return (Mymethod(n-1))+ (Mymethod(n-2))+ (Mymethod(n-3)); } } }