Java icon indicating copy to clipboard operation
Java copied to clipboard

fix: handle zero case in Armstrong number check to avoid Math.log10(0…

Open Tejaswi1305 opened this issue 6 months ago • 2 comments

Adds a safe check for number == 0 in the Armstrong number logic to avoid a Math.log10(0) exception. Also acknowledges 0 as a valid Armstrong number (since 0^1 = 0).

Why: Without this, passing 0 causes an ArithmeticException due to log10(0). This PR ensures the code handles all valid inputs correctly.

Tejaswi1305 avatar Apr 29 '25 14:04 Tejaswi1305