Pseudocode for plotting a Mandelbrot set. Note the speed optimisation that x and y is only calculated once per iteration. And that "y = 2*x*y + y0" is calculated before "x = x2 - y2 + x0" since otherwise the new x would have to be stored in a temporary variable before y is calculated.

For each pixel on the screen do:
{
  x = x0 = x co-ordinate of pixel
  y = y0 = y co-ordinate of pixel
 
  x2 = x*x
  y2 = y*y
 
  iteration = 0
  maxiteration = 1000
 
  while ( x2 + y2 < 4  AND  iteration < maxiteration ) {
 
    y = 2*x*y + y0
    x = x2 - y2 + x0
 
    x2 = x*x
    y2 = y*y
 
    iteration = iteration + 1
  }
 
  if ( iteration == maxiteration )
    colour = black
  else
    colour = iteration
 
  Plot the pixel with "colour".
 
}
