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. thank you very much indeed Task 1. Asking
This is a problem of c programming language. Please explain to me how to complete this part. thank you very much indeed
Task 1. Asking for the Maximum Number of Stones for Each Turn The first task of the exercise is to write a loop to read the maximum number of stones allowed for each turn. Currently, the code contains only one line and it looks like this: This line of code 'hardcoded' 5 as the maximum number of stones for each turn. In this task, you will replace this line of code by a while loop. This while loop keeps asking for the maximum number of stones for each turn. The loop stops when the maximum number is between 1 to 10 , inclusive. Therefore, the while loop will look like this: do \{ ...ask for the maximum number of stones for each turn... \} (...condition to check if the number is within range...); Here is an example showing you how it works: Please specify the number of stones that can be taken each turn. It should be between 1 and 10:1 Please specify the number of stones that can be taken each turn. It should be between 1 and 10:12 Please specify the number of stones that can be taken each turn. It should be between 1 and 10:1000 Please specify the number of stones that can be taken each turn. It should be between 1 and 10:8 The above example keeps asking for the maximum number of stones for each turn, until the number entered is within the range from 1 to 10 . You can use a simple scanf("\%d", ..) to read the number, assuming that the user (i.e. you) will enter a valid integer 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