"Out of" represents, mathematically, the fraction line. So 40 out of 50 can be represented by 40/50. The percentage can be represented by a fraction over 100. So to transform 40/50 to a fraction /100, we multiply 50 by 2, and of course we should multiply 40 by 2 too.
So 40/50 = 40 * 2/50 * 2 = 80/100 = 80%
So, 40 out of 50 is 80% as a percentage.
Hope this Helps! :)