Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C Complete the following programming exercise. Name the individual project CSCI171_L3b_YourName. When you have complete the exercise, copy the ENTIRE PROJECT FOLDER into the

Using C

Complete the following programming exercise. Name the individual project CSCI171_L3b_YourName. When you have complete the exercise, copy the ENTIRE PROJECT FOLDER into the dropbox

Copy this code into the main.c file of your program. Based on the code, answer/perform the following:

Read through the program and generally determine how you think this if statement will execute.

What will the output be if the value entered for number1 is greater than 4, and number2 is less than 5? Run the code to verify your answer. Be sure you understand why you are getting the resulting output.

Uncomment the last printf statement. If you enter a value of 2 for number1 and 7 for number2, what will the output be? Run the code to verify your answer. Be sure you understand why you are getting the resulting output.

The statement that was just uncommented was meant to be associated with the last else statement, but was coded incorrectly. Fix the code so that it will run as intended, and run the program to be sure everything is working as desired.

Change the code so that it is written using a linearly nested if - make sure you DO NOT change the way the program functions.

//Non-linearly nested if statements

 #include  int main( void ) { int number1 = 0, number2 = 0, number3 = 0; printf("Enter the first number: "); scanf("%d", &number1); printf("Enter the second number: "); scanf("%d", &number2); printf("Enter the third number: "); scanf("%d", &number3); printf(" Entered values:\t%d\t%d\t%d", number1, number2, number3); //Non-linear nested if structure - Identified by the fact that there is //an if nested within another if without an else between them if (number1 < 4) if (number2 < 5) printf(" number1 * number2: %d", number1 * number2); else printf(" number1 - number2: %d", number1 - number2); //printf(" The third number is: %d", number3); return 0; } 

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

1. Organize and support your main points

Answered: 1 week ago

Question

3. Move smoothly from point to point

Answered: 1 week ago

Question

5. Develop a strong introduction, a crucial part of all speeches

Answered: 1 week ago