(Solved):Use C programming language for the following. A robot can take steps of 1 meter, 2 meters, or 3 meters. Write a recursive function to calculate the number of ways that robot can walk n meters (n is… View Answer…

 

Question

Use C programming language for the following.

A robot can take steps of 1 meter, 2 meters, or 3 meters. Write a recursive function to calculate the number of ways that robot can walk n meters (n is an integer obtained from user). As examples:

Distance Sequence of Steps Number of Ways to Walk
1 1 1
2 1,1 or 2 2
3 1,1,1 or 1,2 or 2,1 or 3 4
4 1,1,1,1 or 1,1,2 or 1,2,1 or 2,1,1 or

Scroll to top