Question: #include #pragma warning(disable : 4996) // needed if using Visual Studio // CSE 240 Fall 2018 Homework // Before starting this assignment, please compile and

#include  #pragma warning(disable : 4996) // needed if using Visual Studio // CSE 240 Fall 2018 Homework // Before starting this assignment, please compile and run this program. // You will first notice that the program will not compile. Fix the errors and define the error types. // Next, you will notice that the program is printing incorrect information. Fix the errors and define those error types. int main(){ // Problem 1: (4 points) // The statement below should cause the program to not compile. Correct the error(s). (2 points). p = 20.18; printf("p is equal to %f ", p); // Define what type of error this is, your answer should replace the space next to "Error Type: " below (2 points). // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: ______ "); // Problem 2: (4 points) // Half of 50 is 25, why is the program printing that half of 50 is 0? Correct the error(s) (2 points). int q = 50; printf("Half of %d is %d ", q, q * (1/2)); // Define what type of error this is, your answer should replace the space next to "Error Type: " below (2 points). // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: _______ "); //Problem 3 (2 points) //Integer variable y is initialized to 100 and its value needs to be printed. Correct the error(s).(1 point) int y = 100; printf("y is %c ",y); // Your answer should be either Syntactic, Semantic, or Contextual. (1 point) printf("Error Type: ____ "); //Give your explanation here: printf("________ "); // Problem 4: (2 points) // Float variable f has been initialized to 3.14, why does the program seem to think otherwise? Correct the error(s) (2 points). float f = 3.14; if (f = 10) printf("f is equal to 10. "); if (f > 10) printf("f is greater than 10. "); if (f < 10) printf("f is less than 10. "); // Define what type of error this is, your answer should replace the space next to "Error Type: " below (2 points). // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: ______ "); // Problem 5: (4 points) // Surely, 60 is an even number. Why is the program printing that 60 is an odd number? Correct the error(s) ( points). q = 60; if (q / 2 == 0) printf("%d is an even number. ", q); if (q / 2 != 0) printf("%d is an odd number. ", q); // Define what type of error this is, your answer should replace the space next to "Error Type: " below (2 points). // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: _______ "); // Problem 6: (4 points) // This bit of code is meant to print "Hello World!". Correct the error(s) (2 points). printf("Hello %c ", "World!"); // Define what type of error this is, your answer should replace the space next to "Error Type: " below (2 points). // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: _________ "); 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!