Previous study of contact of power-law graded materials concerned the contact of a rigid body (punch) with an elastic inhomogeneous foundation whose inhomogeneity is characterised by the Young modulus varying with depth as a power function. This paper models Hertzian and adhesive contact of two elastic inhomogeneous power-law graded bodies with different exponents. The problem is governed by an integral equation with two different power kernels. A nonstandard method of Gegenbauer orthogonal polynomials for its solution is proposed. It leads to an infinite system of linear algebraic equations of a special structure. The integral representations of the system coefficients are evaluated, and the properties of the system are studied. It is shown that if the exponents coincide, the infinite system admits a simple exact solution that corresponds to the case when the Young moduli are different but the exponents are the same. Formulas for the length of the contact zone, the pressure distribution and the surface normal displacements of the contacting bodies are obtained in the form convenient for computations. Effects of the mismatch in the Young moduli exponents are studied. A comparative analysis of the Hertzian and adhesive contact models clarifies the effects of the surface energy density on the contact pressure, the contact zone size and the profile of the contacting bodies outside the contact area.