a=1 b=7
Comments: It is good defensive programming to write your code so that
the scope of a variable is no larger than is needed, and to declare variables
close to their first use (but not in a place that obscures the logic of the
program). In this program, temp
is used only inside one block,
so it is declared at the top of that block.