Ali went to a shop to buy 50 kg of rice. He buys two varieties of rice which cost him Rs. 4.5 per kg and Rs.5 per kg. He appends a total of Rs. 240. What was the quality of cheaper rice bought by him?

A) 20 kg

B) 25 kg

C) 30 kg

D) None of these

Let A be the amount of type of first rice and
B be the Amount of second type of rice

According to question:  A + B = 50 Kg
Also
                           A  x 4.5 + B x 5 = 240 Rs
Thus solving the above two equations
                    (50 – B) x 4.5 + 5B = 240
                       225 – 4.5 B + 5B = 240
                                          0.5 B = 15
                                                 B = 15/ 0.5
                                                 B = 30 Kg
                                        Thus A = 50 – 30 = 20 Kg