Opening your workspace…
Workspace/Coding room
Opening your workspace…
Fry wakes up from cryogenic sleep and checks his account at the Bank of Earth. He had 93 cents when he went into the freezer. His account earns 2.25% interest each year, and the next year’s interest applies to the whole balance. Given how many years Fry spent frozen, return the interest he earned in cents. Subtract his original 93 cents and round only once, at the end, to the nearest cent. Round half a cent up.
1Output2The first year earns 93 × 0.0225 = 2.0925 cents, which rounds to 2 cents.
2Output4The second year starts with 95.0925 cents. After two years, Fry has earned 93 × (1.0225² − 1) = 4.23208125 cents, which rounds to 4 cents.
Keep the growth factor as a fraction and round the final interest in cents.
function solve(years) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.