A heat engine converts only part of its heat input into useful work.
Read the engine budget
The engine takes in 30 joules of heat and produces 12 joules of useful work.
Qin=30 JWout=12 J
Efficiency is useful work over heat input
Efficiency counts the fraction of heat input that becomes useful work.
η=QinWout
Compute the efficiency
Divide 12 joules by 30 joules. The efficiency is two fifths.
η=30 J12 J=52