Suppose you write a program for computing the perimeter of a rectangle and you mistakenly write your program so that it computes the area of a rectangle. What kind of error is this?
This kind of error is a logic error. A logic error produces an undesired output, although it may not immediately be recognized as such. Logic errors occur in both compiled and interpreted languages. In this program, we got a logic error because we should write a program for computing the perimeter of a rectangle but here we mistakenly write a program to compute the area of a rectangle.