initialized uninitialized local vars
add clarifying parentheses
fix incorrect format specifier
rename shadowing local variable
enhance conditional to silence div-by-zero warning
rewrite init to silence warnings