The zeroth law of thermodynamics allows the assignment of a unique temperature to systems which are in thermal equilibrium with each other.
The first law of thermodynamics mandates conservation of energy and states in particular that the flow of heat is a form of energy transfer.
The second law of thermodynamics states that the entropy of an isolated macroscopic system never decreases, or, equivalently, that perpetual motion machines are impossible.
The third law of thermodynamics concerns the entropy of a perfect crystal at absolute zero temperature, and implies that it is impossible to cool a system to exactly absolute zero.
Classical thermodynamics describes the thermal interaction of systems that are individually in a state of thermodynamic equilibrium. Thermal equilibrium is a statistical condition of macroscopic systems, while microscopically all systems undergo random fluctuations. The laws of thermodynamics are strictly valid only in the thermodynamic limit when a macroscopic system may be described practically by an infinite number of microscopic states to satisfy the laws of statistics. Every finite system will exhibit statistical fluctuations in their thermodynamic parameters (entropy, temperature, pressure, etc.), but these are negligible for macroscopic systems, only becoming important for microscopic systems.
The First Law basically says that energy or matter can neither be created nor destroyed. In terms of the machine, this meant that the total energy output (work by the machine) is equal to the heat supplied. In other words, the change in the internal energy of a closed system is equal to the heat added to the system minus the work done by the system. Because the system operates in the real world, some energy always escapes into the outside world, thus leading to both inefficiency and the Second Law, which was generated to cover the so-called flaw in the First Law.
The Second Law essentially says that it is impossible to obtain a process where the unique effect is the subtraction of a positive heat from a reservoir and the production of a positive work. Energy exhibits entropy. It moves away form its source. In this sense, energy or heat cannot flow form a colder body to a hotter body. You cannot keep a continual flow of heat to work to heat to work without adding energy to the system. In machine terms, you have to add energy to get more work, and the ratio of heat to work will never equal 100% due to energy expanding away from its source.