It is very poor practice to use two variables with the same name, even if one is local and the other global. There is absolutely no reason for doing this. Also, it is best to devise variable names which are meaningful and indicate the content - not meaningless "a", but (say) "firstnumber" or "customernumber".
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.