Let the cost of pen be Rs.x and cost of pencil be Rs.y
Then according to the question,
x+y=20 and x−y=10
Adding these equations ,
x+y+x−y=20+10
2x=30
x=15
From the above quation
y=5
Cost of pen is Rs.15 and cost of pencil is Rs.5