HTML Lists Questions and Answers

Read tutorials from HTML Lists


Question List:



Short Question Share

This is a logical error (or semantic error).

Explanation:

  • A logical error occurs when a program runs without crashing but produces incorrect results due to flawed logic.
  • In this case, the mistake is in the formula:
    • Perimeter of a rectangle = 2 * (length + width)
    • Area of a rectangle = length * width
  • Since the program does not crash and still produces an output (though incorrect), it is not a syntax error or runtime error but a logical error.

How to Fix It?

Carefully check the logic and formulas before running the program. Using print statements or a debugger can help identify logical errors. 🚀