Walking
Lesson 24 of 32 in Coddy's Coding Problems course.
Challenge
HardJohn wants to walk 10.000 steps every day, so he could be healthy. But unfortunately, today his pedometer (app for counting steps) doesn't work.
John already measured that he walked X minutes and ran Y minutes, but he is sure that he still hasn't achieved his 10.000 steps mark.
Write a program that will calculate how many more steps does John need to make to achieve his goal if you know that when he is walking he makes 2 steps in a second, while when he is running he is making 4 steps in a second.
Write a function named steps that given two natural numbers X and Y from input. Output the remaining steps John needs to make to achieve his goal
Input
15 25
Output
2200
Input
26 22
Output
1600
Try it yourself
int steps(int a1, int a2) {
// Write code here
}All lessons in Coding Problems
1Course Introduction
Introduction