The snail climbs up 7 feet each day and slips back 2 feet each night. How many days will it take the snail to get out of a wel | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The snail climbs up 7 feet each day and slips back 2 feet each night. How many days will it take the snail to get out of a wel

Hello everyone this question i want to know how to solve it with c++,as we enter the value of the depth of the well

28th Dec 2021, 9:22 PM
Abdelbaset Mohamed
1 Answer
+ 2
You can approach the task like this: * get input for depth (integer) * use a while loop to calculate the current position of the snail 🐌 * break from loop when the snail 🐌 is out of the well
28th Dec 2021, 10:25 PM
Lisa
Lisa - avatar