Calculator with simple input
If you're about to perform division, you must first check for 0 as the given divisor.  To prevent this, it may be best to warn the user, and make sure they input a valid number before proceeding.

For the exponentiation, you can have a "shortcut" by returning 1 instantly if b is 0.  There's no need to attempt calculations since anything raised to the 0 power is always 1.  You should also handle negative powers in some way.  The code will break if the user inputs such a value for b.  This loop cannot handle all of these possible values.