An internal combustion engine works on the principle of detonating the fuel inside the combustion chamber which will eventually push the piston. The reciprocating motion of the piston inside the cylinder is transformed into rotational motion by the crankshaft.
A flywheel maintains the momentum of the rotation and smoothens the power output from the piston to the crankshaft.
The working of an internal combustion engine is intricate and there is a hell lot of science to make it work perfectly.
Almost every car uses a four-stroke combustion cycle in its internal combustion engine.
The four strokes are
Intake stroke
As the piston moves downwards the inlet valves open up and because of suction the air is drawn inside the cylinder. The inlet valves remain open till the piston reaches the bottom dead center of the cylinder. There is a difference in the introduction of fuel and air in the diesel and petrol engines.
Compression stroke
After the suction stroke, the piston moves from the bottom dead center to the top dead center compressing the mixture of air and fuel. During the compression stroke, the temperature of the mixture rises.

Combustion stroke
As the piston reaches the top dead center of the cylinder. The combustion is initiated. Then piston is pushed downwards due to the pressure generated by the explosion. As the piston moves towards the bottom dead center, the exhaust valve gets open. There is a difference in how combustion occurs in diesel and a petrol engine.
For more information on diesel engine and petrol engine go to this link:https://theenigmaticcreation.in/2020/03/23/diesel-engine-and-petrol-engine/
Exhaust Stroke
After the combustion stroke, the piston moves from the bottom dead center to the top dead center which pushes the burnt gases outside the cylinder via the exhaust valve.
This is one cycle of combustion. After the completion of the final stroke, the cycle starts with the suction stroke.
The camshaft and cam follower provide the perfect timing of both the valves.
The linear movement of the piston is converted into the rotary motion of the by the crankshaft.
Component of an internal combustion engine

Engine Block
It is the part between the cylinder and the sump( the oil pan). It is the core part of the engine on which other thing are mounted. The large holes in the block casting form the cylinder bore in which the piston moves. The cylinder also has the bulkhead which supports the crankshaft and the head attachment.
The cylinder block also comprises the passage for the coolants. In general, the diesel engine has a heavy cylinder block than the petrol engines. In the engine block, the cylinder can be put in different orientations namely inline, V and flat. There can multiple cylinders in an engine block depending on the power output requirement. The engine block is generally cast from the iron or aluminum alloy.
Spark Plug
It provides the spark that ignites the air-fuel mixture present in the combustion chamber. It is present in the different positions to initiate combustion at the right time. Only otto engines have spark plug. Diesel engines don’t have any spark plug for combustion.
Valves
There are two valves inlet and outlet valve present on the cylinder head. These valves open and close to let air-fuel mixture in and burnt gases out. Both the valves remain close during compression and combustion stroke.
Piston
It is cylindrical in shape and bears all the force produced during combustion. A piston has a connecting rod connected below it to transfer its motion to the crankshaft.
Piston rings
These are one of the smallest parts of the internal combustion engine. But they place a significant role in sealing the gap between piston and cylinder. Piston rings prevent the flow of air-fuel mixture and burnt gases into the sump from the combustion chamber. In addition, the sump is prevents leaking of oil by piston rings.
Connecting rod
It connects the piston with the crankshaft and rotates at its both ends so that its angle can change when the piston moves. The connecting rod is made up of steel.
Crankshaft
It converts the reciprocating motion of the piston into the rotary motion. It is also connected with the flywheel which converts the irregular motion into a smooth one.
Sump
It is below the engine block and surrounds the crankshaft. It contains oil which we generally know as engine oil. The main purpose of the oil is to provide proper lubrication between the moving parts of the engine.