In C program
We want to emulate that, too! Using a recursive function, make it so that we print the number we are currently in on a new line. When we encounter a number n divisible by 5, we print "YEHEY" and jump 7 steps forward. However when we encounter a number divisible by 8, we print "OHNO" and go back 6 steps. If it is divisible by both, we print "LUCKY" and jump 11 steps. Otherwise just move 1 step. Start at n=1 and continue doing this until you reach a number greater than or equal to the number entered by the user.
Instructions:
In the code editor, you are provided with a main() function that must ask the user for a number and calls the snake_ladder() function.This snake_ladder() function is a recursive function which should perform the functionality explained in the problem description above.This function is declared but is initially empty.Input
1. Stopping number
Description
Input the number to which the recursive function must stop
Constraints
The input is a positive integer that does not exceed 10000.
Sample
100Output
Enter stopping number: 10012345 YEHEY12131415 YEHEY222324 OHNO181920 YEHEY27282930 YEHEY37383940 LUCKY5152535455 YEHEY626364 OHNO585960 YEHEY67686970 YEHEY77787980 LUCKY9192939495 YEHEY102
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here