public class ClimbStairs {
private static int getClimbWays(int n) {
int a = 1;
int b = 2;
int tmp = 0;
int i = 0;
if (n == 1) {
return 1;
} else if (n == 2) {
return 2;
} else {
for (i=3; i<=n; i++) {
tmp = a + b;
a = b;
b = tmp;
}
return tmp;
}
}
public static void main (String[] args) {
int climbWays = 0;
climbWays = getClimbWays(10);
System.out.println("There are "+ climbWays + " ways to climb 10 steps ");