The first step is to realize that this is not the end of the world. Don't panic. A delay is not a denial. Slow and steady wins the race. In other words, you fall down but you don't stay down. You get back up with a game plan and purpose to fight again. Learn from your mistakes. Alright enough of the platitudes, let's get to work!
It is not the end of the world, you can recover from this. You just need a plan of attack and strategy to be successful.
Review the exam and identify what problems you missed. You may want to share your exam with a friend so you two can compare what each of you missed and what each of you got right.
Think about why you missed the problems. Was it lack of knowledge, lack of time, math mistakes? Something else?
Don't look at the solution or answers first but try to rework the exam to see if you can now get the correct answers. Then use the solutions or answers to check your work. Do you now understand why it was wrong.
Sorry! I know it is cheesy but I have to make my R theme work. I am also a fan of alliteration, so humor me :). This R means go to office hours and review your exam with your professor or the teaching assistant. In fact, do this for every time you earn a D or F on any assignment.
In the future, before the next exam do the following.
set up weekly tutoring or office hours appointments
join a study group and meet with them regularly to do labs, homework, assignments
start on all assignments early so you can ask for help if you need it before the due date
go to class everyday, sit in the front, take notes, and engage by asking and answering questions
discuss in advance with professor any time you will be absent
plan to study 2 hours for every hour you are in class and think about your academic journey like a 40 hour per week job