It does not seem like a simple case of iterating over the package list and removing that package as some will be system packages which are vital to basic operation (unless you specifically want to brick the system, then you might as well reinstall).
If you want to see what packages are on the system but don't seem to be depended on for anything, you could run package-cleanup --quiet --leaves
from yum-utils
( or package-cleanup --quiet --leaves --exclude-bin
to exclude binaries ).
To remove all oprhaned packages automatically try:
package-cleanup --quiet --leaves --exclude-bin | xargs yum remove -y