Well in the usual case, you start with a flowchart as a means to create the program in the first place.

Producing a flowchart of something you've hacked together is a less useful thing to do.

But....
Each brace-enclosed block of code is a square
Each conditional (for, while, if) is a diamond with suitable arrows leading to/from it.

That should get you close enough.