Question: Write a C program that performs the following tasks: Continuously takes an integer input from the user. If the input is negative, skip the rest
Write a C program that performs the following tasks:
Continuously takes an integer input from the user.
If the input is negative, skip the rest of the loop and prompt the user for another input using the continue statement.
If the input is zero, break the loop using the break statement.
If the input is a positive even number, print a message "Even number entered."
If the input is a positive odd number, print a message "Odd number entered."
Use a goto statement to handle an invalid input that is not an integer, prompting the user to reenter a valid integer.
Input and Output:
Enter an integer:
Enter an integer:
Even number entered.
Enter an integer:
Odd number entered.
Enter an integer:
Program terminated.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
