0
How to solve this and why?
You need to plan a road trip. You are traveling at an average speed of 40 miles an hour. Given a distance in miles as input (the code to take input is already present), output to the console the time it will take you to cover it in minutes. Sample Input: 150 Sample Output: 225
3 Answers
+ 3
There is a quick arithmetic method for solving such proportions:
60 minutes - 40 miles
x minutes - y miles
Now you multiply diagonally and equate:
60y = 40x
You are solving for x, so:
x=1,5y
y is your input in miles
The reality is without the basic math knowledge, it will be hard for you to tackle any programming problem. My advice would be for you to focus on the maths and then try to apply your knowledge to some programming challenges.
+ 2
So you actually just need the formula, this is something that you should figure out
Tip: division and multiplication will come in handy
+ 1
Mikolaj is correct, you need to know some math for programming. I realized it way too late đ