Question: 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

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