Facebook

Animated Donut : C program


Hi,

Just like my previous post in which India's map was generated using an obfuscated C code, here an animated donut will be generated, again using C code.

Note : This is not my work. All credit to original author (link at the bottom).


This donut program has two versions.

Version 1:

(To avoid any error due to formating and special characters, I am including screen-shots of the code. Actual code can be found on the Original Author's page. Copy the code and save it in a file donut.c and compile using the command given below.

 


Execute this Code using the command -
gcc -o donut donut.c -lm
Ignore any warnings. Now run it using command -
./donut

Output should look like below image:







Version 2:

This is much more impressive.




Save and compile this code again using the same command and run it.

Credit - Andy Sloane 
Follow this link to know the mathematics behind this animation.