Let us assume that cost of each granola bar be $x and that of a cup of yogurt be $y
From person A's purchase, we get
12x + 7y = 15.5; equation A
And from person B's purchase,
6x + 11y = 11.5; equation B
Let us multiply equation B by 2 and subtracting equation A from it, we will get
12x + 22y - 12x - 7y = 23 - 15.5,
=> 15y = 7.5
or, y = 0.5
Substituting value of y in equation A, we can find x
12x + 7*0.5 = 15.5
=> x = (15.5 - 3.5)/12
or, x = 1
Therefore, cost of granola bar is $1, and that of yogurt is $0.5