The efficiency of an ideal Carnot heat engine can be written as:
[tex]\eta = 1- \frac{T_{cold}}{T_{hot}} [/tex]
where
[tex]T_{cold}[/tex] is the temperature of the cold region
[tex]T_{hot}[/tex] is the temperature of the hot region
For the engine in our problem, we have [tex]T_{cold}=300 K[/tex] and [tex]T_{hot}=400 K[/tex], so the efficiency is
[tex]\eta= 1 - \frac{300 K}{400 K}=0.25 [/tex]