Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include // CSE 220 project 02 Question 3 (25 points) // Before starting to edit, please compile and run this program. // You will first

#include

// CSE 220 project 02 Question 3 (25 points) // Before starting to edit, please compile and run this program. // You will first notice that the program will not compile. Fix the error(s). // Next, you will notice that the program is printing incorrect information. Fix the errors (2.5 points) and write error types(2.5 points). void main() {

// Problem 1: (5 points) // The statement below should cause the program to not compile. Correct the error(s). (2.5 points).

int num1 = 50.2; num2 = 10; printf("num1= %d, num2= %d ", num1, num2);

// Write error type in blank below (2.5 points). // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: _____ ");

// Problem 2: (5 points) // A garbage value is printed. Correct the error(s). float num3= num1 + num2; printf("num3= %d ", num3);

// Write error type in blank below // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: _____ ");

// Problem 3: (5 points) // The program does not print any of the three statements. Correct the error(s). int num4 = 5;

if (num4 = 0) { printf("num4 is equal to %d. ", num4); printf(" So num4 is 0. "); }

if (num4 > 0) { printf("num4 is equal to %d. ", num4); printf("So num4 is positive. "); }

if (num4 =< 0) { printf("num4 is equal to %d. ", num4); printf("So num4 is negative. "); }

// Write error type in blank below // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: _____ ");

// Problem 4: (5 points) // The program prints that 20 is an odd number. Correct the error(s). int num5 = 20;

if (num5 / 2 != 0) printf("%d is an odd number. ", num5); if (num5 / 2 == 0) printf("%d is an even number. ", num5);

// Write error type in blank below // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: _____ ");

// Problem 5: (5 points) // We want to print "I study in CSE 220 and hoping to get A grade.". Correct the error(s). int courseNum = 220; char grade = 'A'; printf("I study in CSE %d and hoping to get %f grade. ", courseNum, grade);

// Write error type in blank below // Your answer should be either Syntactic, Semantic, or Contextual. printf("Error Type: _____ "); system("pause"); // needed to keep console open in VS }

Can you fix the errors in this program. read the first five lines to get better understanding.

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

Recommended Textbook for

Database Theory Icdt 97 6th International Conference Delphi Greece January 8 10 1997 Proceedings Lncs 1186

Authors: Foto N. Afrati ,Phokion G. Kolaitis

1st Edition

3540622225, 978-3540622222

More Books

Students also viewed these Databases questions

Question

List out some inventory management techniques.

Answered: 1 week ago

Question

2. What potential barriers would you encourage Samuel to avoid?

Answered: 1 week ago