[Solved] Why is this simple thing giving an error?


Your code divides by zero whenever a and b are 0. That’s not going to work. You need to change your loop to check the values before you try to use them.

solved Why is this simple thing giving an error?