To solve for c means to isolate c. By the way, this applies to any variable.
Begin by subtracting ab from both sides.
ab - ab + c = 5 - ab
Of course, ab - ab will cancel out leaving us with c on the left side.
c = 5 - ab...This is your answer.
You were given ab + c = 5
Let c = 5 - ab
If we get the same answer on both sides, then we know that c = 5 - ab is correct.
ab + c = 5
Replace c with 5 - ab
ab + 5 - ab = 5
5 = 5...It checks!!
So, the right answer is c = 5 - ab