By selling 45 bananas for Rs 40,
40/45 = 0.888888888 Rs/banana
If he is losing 20% on this deal,
This means that
0.8888888/x = 80/100
88.88888 = 80x
Divide both sides by 80
x = 1.1111111111
So, if he wants to make 0% profit, he must sell the 45 bananas for 1.11111 Rs each.
If he wants to make 20% profit for 45 bananas,
1.111111 x 1.2 = 1.3333333
He will need to sell each banana for Rs 1.3333333.
So,
y = 1.333333x
And we are given
y = 24x
We can equal these equations to each other
1.333333333(45) = 24x
60 = 24x
x = 2.5
He will need to sell only 2.5 bananas.