A great variety of nuclear gamma rays emitted from fission and activation products of spent nuclear fuel contains much information that can be elicited without affecting the integrity of the fuel elements. But the extraction of such information from the complex spectrum is difficult and requires computer codes. In the present work, a versatile code 'CAERI' was developed which locates peaks and calculates their areas for X-rays as well as gamma rays using elegant features of some widely used programs for gamma-ray peak fitting. 'CAERI' coded in FORTRAN used infinite series approximation more accurate than other workers various, simple, piecewise series approximations for evaluations of the Voigt function which represents the X-ray peak with non-negligible natural line width. 'CAERI' can handle even a complex multiplet consisting of peaks from X-rays and gamma rays in arbitrary mixture, which one often encounters in the isotopic analysis of heavy elements such as U and Pu. The results of the fitting performed on the test spectra of $^{177m};Lu;{gamma}-ray;and;^{235}U;K_{alpha}$X-ray show good agreement with those by previous workers.