An internal combustion engine is any engine that operates by burning its fuel inside the engine. In contrast an external combustion engine burns it fuel outside the engine, for example a steam engine. The most common internal combustion engine is the gasoline powered engine. Others include those fueled by diesel, hydrogen, methane, propane, etc. Engines typically can only run on one type of fuel and require adaptations to adjust the air/fuel ratio or mix to use other fuels.
In a gasoline engine, a mixture of gasoline and air is sprayed into a cylinder. This is compressed by a piston and at optimal compression, a spark plug sends an electrical spark that ignites the fuel. The combustion of the fuel results in the generation of heat, and the hot gases that are in the cylinder are then at a higher pressure than the fuel-air mixture and so drive the piston back down. These combustion gases are vented and the fuel-air mixture reintroduced to run a second stroke. The outward linear motion of the piston is ordinarily harnessed by a crank shaft to produce circular motion. Valves control the intake of air-fuel mixture and allow exhaust gasses to exit at the appropriate times.