Switching majors at a critical stage I'm about to finish my 4th semester as a pure mathematics undergraduate. I took one introductory course to programming in my first semester, and another more advanced one lately. Although it was only one course out of several others I took last semester, I spent much more time on the computer than on the math books, and I conjectured that I would probably be happier as a programmer than as a mathematician. 

The problem is that I spent most of the past 3-4 years doing nothing but mathematics. Practicing problem-solving, developing critical thinking, establishing deep knowledge in foundational mathematics and growing very good general knowledge about advanced math topics and history of mathematics. Besides, I get top grades in my college, and I do like what I am doing.

In brief, I can see myself as a promising person in the world of mathematics. I am confident that in comparison to most of my peers, I am more powerful in this domain. And this, in particular, is what makes me hesitate about even thinking of switching my major. 

Above all, I enjoyed that programming course much more than I enjoyed any other math course that I took (except, perhaps, metric topology and some abstract algebra). And I have a feeling that this is what I should truly go for.

What is the best decision that could be done? Especially that I still have only one year to get my Bachelor degree. If I would switch my major, I'll have lost one year of my life because of the regulations in our college.

Thank you.
Change-of-interest among mathematicians is more common than many would have imagined. Reasons vary, some decided to do something more applied, some decided to work in the industry for the better pay, some decided to work in a more dynamic environment than the academia...

I can assure you that the time you spent on mathematics is time well spent for your intellectual development and that your advanced math training will be a valuable asset wherever you go. Even though you may not be solving abstract algebra or real analysis problems for your future career, it's the analytical skills that you're equipped with that will make a difference between you and other candidates. Mathematicians, if well trained, develop unique insights to problems and are often highly detail-oriented.

If you want to switch to computer science, there are a number of Masters Programs in computer science that will accept non-CS majors. In fact, if you have taken sufficiently many advanced courses in computer science, you may apply to grad school in computer science right away without going through the (often exorbitantly costly) masters program. Many of my classmates have done that and successfully transitioned into computer science.

Last but not least, speak to your academic advisor and discuss your situation.

Good luck!