Created
August 20, 2014 05:20
-
-
Save hilda8519/64d908e42fae1ac7a8e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package numberofways; | |
public class numberofways { | |
public static int numberways(int n){ | |
if(n<0){ | |
return 0; | |
} | |
if(n==0){ | |
return -1; | |
} | |
else{ | |
return numberways(n-1)+numberways(n-2)+numberways(n-3); | |
} | |
} | |
public static void main(String[] args){ | |
System.out.println(numberways(100)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment