Explain the difference between syntax errors, run-time errors, and logic errors. Provide an example of each.
The difference between them is mentioned below.
|Syntax error||Run-time error||Logical error|
|It occurs when the interpreter fails to recognize the code.||It occurs when the interpreter fails to execute the code.||It occurs when the code does not produce the correct output.|
|An error message is generated in this case.||An error message saying the reason for error is displayed in this case.||No error message is generated.|
|The program is not compiled successfully.||The program is compiled successfully but it does not run to completion.||The program runs to completion but the output produced is incorrect.|