Flowchart in latex

We are using tikz ´╗┐library ´╗┐to draw a flowchart. In this flowchart, no scenario is presented with flowcharts, only presentation is shown

Example

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

\begin{document}

\begin{figure}
\centering
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20, text width=5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=10em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm, minimum height=1em]
    
\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [cloud, text width=5em, text badly centered] (init) {Start};
\node [block, below of=init] (assign) {i = 1};
\node [block, below of=assign] (increment) {increment i by 2};
\node [block, left of=increment, node distance=3cm, text width=5em, fill=red!20] (incBy9) {increment i by 9};
\node [block, below of=increment] (functionCall) {perform the function};
\node [decision, below of=functionCall] (evenOddCheck) {is i even or odd};
\node [cloud, below of=evenOddCheck] (stopping) {program closed then STOP};

% Draw edges
\path [line] (init) -- (assign);
\path [line] (assign) -- (increment);
\path [line] (increment) -- (functionCall);
\path [line] (functionCall) -- (evenOddCheck);
\path [line] (evenOddCheck) -| node [near start] {No} (incBy9);
\path [line] (incBy9) |- (assign);
\path [line] (evenOddCheck) |- (stopping);
\path [line] (evenOddCheck) -- ++(2.8cm,0cm) |- node [near start] {Yes} (assign);

\end{tikzpicture}
\caption{Problem formulation and the process} \label{fig:M1}
\end{figure}

\end{document}

Output

tex

Share

You may also like...