Question: Code in C: I'm trying to write code for a pick up sticks game for an assignment. The user can only enter 1,2, or 3
Code in C:
I'm trying to write code for a pick up sticks game for an assignment. The user can only enter 1,2, or 3 sticks to pick from a pile. If two invalid numbers are entered in a row then the program is supposed to terminate. I'm having trouble figuring out how to get the program to accept only a 1,2, or 3. When I use the current code I have or try to use the variable I tied to scanf, the while loop considers any number entered as invalid. Even if a 1,2, or 3 is entered. What's a good way to write the code so it will compare the command line argument to either 1,2, or 3 and terminate after 2 incorrect tries in a row?
Here's the code I have:


#include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
