146k views
3 votes
The following code has which kind of error?

total = 0

x = 0

while x < 10:

total = total + x

x = x + 1


A. syntax

B. runtime

C. logic

D. fatal

(it would also be helpful to me to say where the error is but you don't have to)​

User Eduffy
by
4.6k points

1 Answer

9 votes

Answer:

There would be a logic error.

Step-by-step explanation:

The count for x should have been initialized before addint it to the variable total.

User Ashley Swatton
by
4.1k points