Bactrim is a combination of trimethoprim and sulfamethoxazole and is in a class of medications called sulfonamides. It works by…