## Game Platform

A gaming company is working on a platformer game. They need a method that will compute the character's final speed, given a map and a starting speed.

The terrain on which the game character moves forward is made from various pieces of land placed together. Implement the method calculate_final_speed which takes the initial speed of the character, and an array of degrees of inclination that represent the uneven terrain.

The speed of the character will increase or decrease proportionally to the incline of the land, as shown in the image below:

The magnitude of the angle of inclination will always be < 90°. The speed change occurs only once for each piece of land. The method should immediately return 0 as the final speed if an incline reduces the speed to 0 or below 0, which makes the character lose 1 life.

For example, the below code:

``````int inclinations[] = { 0, 30, 0, -45, 0 };
int array_length = sizeof(inclinations) / sizeof(inclinations[0]);
printf("%.2f\n", calculate_final_speed(60, inclinations, array_length));``````

should print:

``75.00``
C18

• AI-resistant
• C
• Arithmetic
• Arrays
• Iteration
• New
• Public
• Easy

Difficulty: Easy

Duration: 15 min

### Score Distribution

Not enough data for chart.

#### Would you like to see our other questions?

We have 1000+ premium hand-crafted questions for 160+ job skills and 20+ coding languages. We prefer questions with small samples of actual work over academic problems or brain teasers.

## Would you like to see our tests?

The following tests contain C related questions:

#### On the blog

Since we're all biased and we use incorrect proxies, why not just outsource hiring to experts or recruitment agencies? After all, they've been screening people for many years, so they must know how to do it right?

Not really. I was surprised to discover that many experts...