Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visualizing Health And Healthcare Data Creating Clear And Compelling Visualizations To See How Youre Doing

Authors: Katherine Rowell ,Lindsay Betzendahl ,Cambria Brown

1st Edition

1119680883, 978-1119680888

More Books

Students also viewed these Databases questions