I want to represent the logic of my program through a diagram, since the program is pretty complex; I need a way to explain to another person, why and how something happens in my program. Is flowchart the only option?
In UML, different diagrams are intended for different things, using different methodologies. Considering we tend to lean to the Object Oriented Methodologies, I will explain the different diagrams and how they work.
Use Case Diagram - The point of use case models is to identify and define all of the elementary business processes that the system must support. This is from both a user and a system point of view. Any single action within your system can be used in a use case, which then will allow further more explanatory models to be used.
Activity Diagram - This is a type of workflow diagram used for describing what goes on in a use case diagram. It is basically a visual method to describe the flow of an activity, or multiple activities.
Sequence Diagram - This is a diagram to show communication between different objects in a system, or a process. Sequence diagrams are important in analysis, as they become crucial for detailed system design and user interface design. I really like these as they give a fantastic view of what is happening in the system.
State Machine Diagram - This allows you to track the states of objects throughout their lifetime, which gives great insight into how objects are meant to work. This gives the ability on how to map events and the like effectively in the system.
Using the above mentioned diagrams gives a great basis for analysis and design, and one should note that once these diagrams are created, they are not necessarily complete. In design processes, you will alter these diagrams as the system evolves. I hope this helps you. Below are links to wikipedia for the different diagrams mentioned.