Let, the cost of a pencil = Rs.x
Then, the cost of a pen = Rs. (x + 15)
Now, By question
x + (x + 15) = 35
or, x + x + 15 = 35
or, 2x = 35-15
or, x = 20/2
or, x = 10
and x + 15 = 10 + 15 = 25
Therefore, the cost of the pen is rs. 25 and the cost of a pencil is Rs. 10.