hello.c (580B)
1 #include "system.h" 2 3 int main(int argc, char** argv) { 4 int top = 1000, bottom = -1000, ystep = 50; 5 int left = -2500, right = 1000, xstep = 30; 6 int maxiter = 1000; 7 8 for (int y0 = top; y0 > bottom; y0 -= ystep) { 9 for (int x0 = left; x0 < right; x0 += xstep) { 10 int i = 0, x = 0, y = 0, ch = ' '; 11 while (i < maxiter) { 12 int x2 = x * x / 1000; 13 int y2 = y * y / 1000; 14 if ((x2 + y2) > 4000) { 15 ch = (i > 9) ? '@' : (i + '0'); 16 break; 17 } 18 y = 2 * x * y / 1000 + y0; 19 x = x2 - y2 + x0; 20 i++; 21 } 22 dputc(ch); 23 } 24 dputc('\n'); 25 } 26 return 0; 27 }