loop incrementing but not printing increments

  if(x = 20)

This sets x to 20. Perhaps you meant to use the == operator?

Next time, use [ code ] tags.