Question: Sample Output: Guess the number ( between 1 and 1 0 ) . You have 3 attempts. Enter your guess: 8 Too high! Try again.

Sample Output:
Guess the number (between 1 and 10). You have 3 attempts.
Enter your guess: 8
Too high! Try again.
Enter your guess: 5
Too low! Try again.
Enter your guess: 6
Congratulations! You guessed the number.
Guess the number (between 1 and 10). You have 3 attempts.
Enter your guess: 1
Too low! Try again.
Enter your guess: 2
Too low! Try again.
Enter your guess: 9
Too low! Try again.
Sorry, you've used all your attempts. The number was: 10 Grading Criteria:
Grading Criteria
Program executes and achieves desired output: 100 points
Calculation errors: -5 points each
Compilation errors: -10 to -20 points (based on severity)
Lack of indentation or poor formatting: -5 points
Input handling errors: -10 pointsLab 2: Number Guessing Game with Functions, Loops, and Conditionals
Instructions:
In this lab, you will develop a number-guessing game. The game will use functions to
organize the code, loops to allow the user multiple attempts, and conditional statements
to provide feedback. The user will have 3 chances to guess a randomly generated number
between 1 and 10. File should be named (Lab2.c)
Goals:
By the end of this lab, you should be able to:
Write and call functions in C to organize your code.
Use loops to repeat tasks (e.g., asking the user to guess).
Use conditional statements (if, else if, else) to provide feedback based on user input.
Generate a random number using the C standard library.
Sample Output: Guess the number ( between 1 and 1

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 Programming Questions!