17.0k views
0 votes
A snail goes up A feet during the day and falls B feet at night. How long does it take him to go up H feet? Given three integer numbers H, A and B (A>B), the program should output a number of days

User Eithos
by
5.2k points

1 Answer

4 votes

Answer:

H=(A*D)-(B*(D-1))

H = A*D- B*D+B

H-B = (A-B)*D

D= (H-B)/(A-B)

Python 3 code

import math

H=int(input('Enter Height: '))

up=int(input('Enter Number of Feet Up: '))

down=int(input('Enter Number of Feet Down: '))

D=(H-down)/(up-down)

print(math.ceil(D),' Days'

Step-by-step explanation:

The output of the Program is given in the attached file.

A snail goes up A feet during the day and falls B feet at night. How long does it-example-1
User IMitwe
by
4.6k points