Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Ask the user for 3 different types of numbers: 1. A positive even number 2. A number between -10 and 10 (inclusive) 3. A positive
Ask the user for 3 different types of numbers: 1. A positive even number 2. A number between -10 and 10 (inclusive) 3. A positive number outside of 18 and 65 Use an if statement to confirm that the user entered in the appropriate type of number. If the user entered in the correct input, print out Correct!. If the user entered in the incorrect input, print out Incorrect!. Lastly, your program should ask the user to enter in the value 2.5. Your program should check to see if the number is close (between 2 and 3, but not 2.5): print out close! if it is correct (2.5): print out Correct! or if it is incorrect: print out Incorrect! Sample program output: Enter in an positive, even number: Correct! Enter in a number between [-10,10]: Incorrect! Enter in a positive number outside of [18, 65] : Correct! Enter in the number 2.5: Close! #LTIC Luue LULU.N> #include int mainc void ) // ask user to enter in an even number int num; printf("Enter in an positive, even number: "); scanf("%d", &num); if ((num > 0) && !(num % 2)){ printf("Correct! "); else { printf("Incorrect! "); // check result printf("Enter in a number between L-10,10)! "); scanf("%d", &num); if ((num >= -10) && (num 0) && (num65) ) { printf("Correct! "); double mun; printf("Enter in the number 2.5: "); scanf("%2f", &mun); if (fabs(mun = 2.5 ) 2 && mun
Step 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