Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is a problem of c programming language. Please explain to me how to complete this part(part2), thank you very much indeed Task 2. Asking
This is a problem of c programming language.
Please explain to me how to complete this part(part2),
thank you very much indeed
Task 2. Asking for the Number of Stones to Take in Your Turn You will be the first to take any stones when the game starts. The program does this by using a big while loop to handle the turns, which looks like this: The loop runs while there are still stones left to be taken. Inside the loop, in your turn, the number of stones taken in the code currently has been set to the maximum allowed number of stones, i.e.: \[ \text { stones_taken }=\text { range_max; } \] Similar to the previous task, your objective is to replace the above line of code so that the program will ask you for the number of stones to take away in your turn. The code you need here is very similar to what you have done in task 1 . The number of stones that you are allowed to take should be within 1 to the maximum number of stones for each turn (the number obtained in task 1). That means you will make a loop like this: do \{ ...ask for the number of stones in your turn... \} (...condition to check if the number is within range...); It would be useful to remind yourself the maximum number of stones for each turn so you need to show this information when you ask the question, as shown by the example below: Please specify the number of stones that can be taken each turn. It should be between 1 and 10:5 There are 34 stones initially. How many stones do you want to take, between 1 to 5?5 How many stones do you want to take, between 1 to 5 ? 8 How many stones do you want to take, between 1 to 5? 7 How many stones do you want to take, between 1 to 5 ? 4 You have taken away 4 stone(s). monomonen As you can see, the 'question text' in the above example shows the range of the number of stones that you are allowed to take. Again, you can assume that the user (i.e. you again) will enter valid numbers into the programStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started