This sounds like homework.
The way to analyze op amp circuits is to determine an equation for the + input and one for the - input. To a good approximation, these will be equal, because, if not, the difference will be multiplied by 1,000,000 or more and sent to the output, which will put the output at the + or - rail.
So write down the two formulae for the + and - inputs, then equate them, and you should have an equation for involving Vout, Vin1 and Vin2. For the 5V case, just substitute 5 for Vin1. Then solve for Vout.
Bob