How make a spinning donut in C

Donut math: how donut.c works –
i read this post a few times, even the source code but it’s really confusing for me about everything, basically i understand how it works but i don’t know how to translate that stuff into programming language (here I use C/C++). Can someone show me the details?