Electromagnets:
Any electric current, or the movement of charge carriers, generate a magnetic field. This field can become very intense in a tightly coiled wire having a number of turns, and which carries a large electric current. When the ferromagnetic core is placed inside the coil, the magnetic lines of flux are concentrated in core, and \ field strength in and near the core becomes tremendous. This is the basic principle of an electromagnet.
Figure-- A ferromagnetic core concentrates the lines of magnetic flux.
Electromagnets are cylindrical in shape majorly. The cylinder is long and thin some times; in the other cases it is short and fat. But whatever the ratio of diameter to length for core, the principle is the same: the magnetic field produced by current results in magnetization of the core.