Using this rule set up, you can able to set discount when Product A is purchased then get discount of 10% in product B. This is using Dependant product based discount.
Buy product Iphone, get discount in Pendrive. Choose the products A and B.
Also you can limit the quantity of the purchase.
With discount tab you can set a percentage or a price discount. Enter the value of discount which should apply for product B.
Here is the Cart with the discount applied.