Question: Write a C program for LoL For a given amount of gold that the user wishes to spend, we can use a computer program to
Write a C program for LoL


For a given amount of gold that the user wishes to spend, we can use a computer program to calculate the optimal amount of health H and armor A that will maximize the Effective Heath E. The two forulae that we will use are H (100 A) 100 GoldToSpend- 2H+18.A Write a C program that asks the player how much gold they wish to spend, then caleulates the optimal amount of H and A that the user should purchase in order to maximize E. Tips to solving this problem: Loop structure must be used, otherwise 0 point for this problem. 1. Loop across all possible values of A: The minimum amount of armor that can be purchased is A-0 and the maximum amount is A GoldToSpend 2. For a given amount of A, solve the GoldToSpend equation for H 3. Calculate E 4. Keep track of the maximum amount of E seen during the loop. Also keep track of the corresponding A and H used to calculate the maximum E. 5. Report the results 1.2 Test your program Sample Code Execution: Red text indicates information entered by the user How much gold do you wish to spend? 10 For 10 gold you should buy 5 Health, and 0 Armor for an effective health score of 5.000 Sample Code Execution: Red text indicates information entered by the user How much gold do you wish to spend? 1000 For 1000 gold you should buy 500 Health, and 0 Armor for an effective health score of 500.000
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
