Question: CSE 240 HOMEWORK1 Question 1: Decrease this code with for loop that receives input from user 5 times. With C language. Question 2: Correct all
CSE 240 HOMEWORK1
Question 1: Decrease this code with for loop that receives input from user 5 times. With C language.
Question 2: Correct all syntax or context errors in the below code, and answer all questions in the blanks

void main() { // Problem 1: (5 points) // The statement below should cause the program to not compile. Correct the error(s). (2.5 points). y = 100 printf("Integer y is equal to %d ", y); // Define what type of error this is, your answer should replace the space next to "Error Type: " below (2.5 points). // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: ________ "); // Problem 2: (5 points) // Half of 10 is 5, why is the program printing that half of 10 is 0? Correct the error(s) (2.5 points). int x = 10; printf("Half of %d is %d ", x, x * (1 / 2)); // Define what type of error this is, your answer should replace the space next to "Error Type: " below (2.5 points). // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: ________ "); // Problem 3: (5 points) // Integer variable x has been initialized to 10, why does the program seem to think otherwise? Correct the error(s) (2.5 points). x = 10; if (x = 20); printf("x is equal to 20. "); if (x > 20); printf("x is greater than 20. "); if (x #include #pragma warning(disable : 4996) // Remove this line in Unix GCC environment void main() char ch; int f, a 10, b= 20; printf("ch-%c ", ch); switch (ch) f case '+': f-a + b; printf("F-%d ", case : f a - b; printf( "f %d ", case .*.. f-a * b; printf("f-%d ", case .'": f a / b; printf( "f %d ", default: printf("invalid operator n") f); f); f); f); printf("ch-cn", ch); switch (ch) case .+': f-a + b; printf( "f-%d ", case : f a - b; printf( "f %d ", case .*.. f-a * b; printf( "f %d ", case .'": f a / b; printf( "f %d ", default: printf("invalid operator n") f); f); f); f); printf("chcn", ch); switch (ch) case .+": f-a + b; printf( "f %d ", case '-': f-a - b; printf( "f %d ", case .*.. f-a * b; printf( "f %d ", case .'": f-a / b; printf( "f %d ", default: printf("invalid operatorIn") f); f); f); f); printf("ch =%c ", ch); switch (ch) ( case .+": f-a + b; printf( "f-%d ", case : f-a - b; printf( "f-%d ", case .*.. f = a * b; printf( "f-%d ", case .'": f-a / b; printf( "f-%d ", default: printf("invalid operator n") f); f); f); f); printf("ch cn", ch); switch (ch) ( case .+': f -a + b; printf( "f =%d ", case : f-a - b; printf( "f-%d ", case .*.. f = a * b; printf( "f-%d ", case .'": f-a / b; printf( "f-%d ", default: printf("invalid operatorIn") f); f); f); f) Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
