The second law of thermodynamics says that we cannot have an engine which converts all the heat into the work.This is because an engine has to work in cyclic process and we cannot have cyclic process which converts all the heat into the work. Right?
For example, in Carnot cycle, in isothermal expansion process, all the heat could be converted into the work if the system is ideal gas. Adiabatic process doesn't exchange heat.
Again, in the isothermal compression, all the work done on the system gets converted into the heat.
So, how is that, we come to the conclusion that in Carnot cycle,all heat could not be converted into work?