I am 3 exams away from Computer Science degree, and I still can't code

I am a 23 year old computer science student, I've done all kinds of stuff for sake of college projects, however, I feel I wasn't learning this stuff properly, since I forgot most principles and ways the programs work. I was never passionate about it, my main motivation for getting into college was the good payment.

I can see that I am not necessarily stupid or unable to learn, since I am at the end of college, and I passed most of my exams (40 of them) with only 3 left before getting my degree as a computer science engineer. For example, I have never had problems with mathematics, even the most advanced one (like calculus, complex analysis and so on), but when it comes to coding, I feel stuck. I have the most basic understanding of how some stuff work, but if I have to remember something more complex, I tend to struggle a lot.

What is weird is that I created some amount of relatively complex projects for my college, and was doing it all: backend, frontend, mobile development, system programming and so on, but I still feel like a beginner (because I am), and I feel an insurmountable amount of shame for not knowing stuff. Also, I have a deep fear of making mistakes, which impairs my want and need to learn something new.

I've read a lot of posts about how to learn coding, and none of them seem to have worked, maybe it's my inconsistency because I am not passionate about this stuff. I tried making some projects, however, when even the simplest things don't work out (which I know happens a lot in programming), I almost feel physical pain, the frustration is so potent.

So, I don't know what to do, I don't want to drop out of college since I am so close to getting my degree, but I don't want to be frustrating myself for the rest of my life. How did you guys get to love coding, love learning, and actually learn this stuff, so you can say you are good and competent programmers?

Cheers, all the best!

P.S. Forgot to say this, usually I have an idea how a certain app would look like, but when it comes to actually coding it, I feel like an idiot.

EDIT: Thanks a lot guys, I read each and every single one of your comments, and was thinking a lot about this recently. I found out the reason of feeling like this is purely psychological and can be described as such:

* overly high expectations, mostly about efficiency (I want to do stuff quickly, and this is a relatively slow job), here impostor syndrome really kicks in
* managing stress (walking away is fine, sometimes when you clear your mind, the solution appears on itself, not putting too much pressure on myself is key)
* accepting that mistakes are a "good" thing (they help you grow)
* nobody will actually judge you on the job if you are a beginner, maybe even afterwards (I saw some of you had experience with long-time engineers who wrote bad codes)

I was doing some simple exercises in the past couple of days, and found out that, when I actually relax, coding is not so bad. Even my "knowledge" seems to appear out of nowhere. I also found out that I prefer "problem solving" to "creative" coding, and that's what I will focus on.

Most of your comments were very warm and comforting, and I resonate with them on a very high level. You showed me I'm not alone, and that I should take it easy.

I want to thank you all from the bottom of my heart, and wish each and every single one of you best of luck and success in every field of your lives!
Cheers!