Find out from the teacher why (if you do not know already). Have a solution in place before letting them know. Just "trying harder" is not going to cut it. It is usually something that can be corrected.
the year isnt over, point out the plan you have to correct this, remember they love you and just want the best,you can do anything, my grama, who i loved with all my heart who is having a dirt nap , I am not insensitive, those were her words, always said it is the measure of ones true character as to how they deal with adversity
Your teacher should have informed your parents half way through the semester that you were failing. This is a mandatory requirement for teachers. Did your parents get the warning? Obviously, you are smart and YOU sure didn't need the warning. Accept the consequences and study hard to improve your grade.
Tell you're parents you'll do whatever it takes to being it up . Extra credit , after school , extra help .. Any of that . You might still have consequences but it will be a lesson learned for the future .