Compact toroidal magnetized plasmas are an important part of the world's magnetic fusion and plasma science efforts. These devices can play an integral role in the development of magnetic fusion as a viable commercial energy source, and in our understanding of plasma instabilities, particle and energy transport, and magnetic field transport. In this paper, we are developing a numerical program to study the magnetic dynamo or relaxation of CT's characterized by arbitrary tight aspect ratio (major to minor radii of tokamak) and arbitrary cross-sections (Multi-pinch and D-Shaped). The lowest ZFE's has been calculated through the Taylor's relaxed state (force-free) toroidal plasmas equation. For ZFE's, we use the toroidal flux vanishing boundary condition along the whole boundary of tokamaks. Several runs of the program for various wave numbers showed that ZFE was very insensitive to the choice of wave numbers. Besides, the CT's poloidal magnetic field topologies are well represented. It was very interesting to check our methods for the cases when aspect ratio tends to unity (zero tokamak whole). A good fulfillment of the boundary condition is achieved.