Question: roblem Write a funct tion called enough that takes one integer parameter (goal) and returns an integer values starting at 1 in a loop until

 roblem Write a funct tion called "enough that takes one integerparameter (goal) and returns an integer values starting at 1 in a

roblem Write a funct tion called "enough that takes one integer parameter (goal) and returns an integer values starting at 1 in a loop until you result. The result is determined by adding consecutive reach (but do not exceed) the goal. The last value added will be returned as the result. Examples For a goal of 9: 1 + 2 + 3 = 6 so the function would return a 3 1+2+3+4 10 which is greater than 9 so the return value has to be 3 For a goal of 10 1+2+3+4=10 so it would return a 4 For a goal of 2 1 +2 3 is larger than two so it would return a one

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!