Execution-Time Errors

In this lesson, we will focus on finding logical errors in a program.

An error in the logic of a program usually goes undetected by the compiler. Rather, such errors cause problems during the program’s execution. As we indicated in the previous lesson of this debugging interlude, a logical error might or might not cause an error message during execution.

Incorrect arithmetic

The program in the previous lesson had a syntax error. The following program corrects that error by inserting the * operator between 2 and y in the computation of z. Execute this program by clicking the RUN button.

Get hands-on with 1400+ tech skills courses.