int main()
{
cout << “Program counts how many times can a ship refuel to get an end upgrade.\n”;
int numOf_pickups = 30;
int coins_per_pickup = 5;
int total_pickup_value = numOf_pickups * coins_per_pickup;
int coins_per_1fueling = 10; int end_upgrade = 100;
int count_fuels = 0;
while (total_pickup_value - (coins_per_1fueling * count_fuels) >= end_upgrade)
{
count_fuels++;
}
// Subtract 1 fuel from count_fuels to get a final result
cout << “You can fuel " << count_fuels - 1 << " times to reach the upgrade at the end of a game level.\n”;
}
1 Like
Great job!
Thanks.
1 Like