Retaking Classes

I flunked a class that tanked my gpa, and I want to know if I retake the course will my new grade only factor into my gpa or will both the new and old grade factor into my gpa?