\documentclass{article}
\usepackage{hyperref}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}
\usepackage{xepersian}
\settextfont{XB Niloofar}
\renewcommand*{\listalgorithmcfname}{فهرست الگوریتم‌ها} % used for list of algorithms
\renewcommand*{\algorithmcfname}{الگوریتم}      % used for title
\renewcommand*{\algorithmautorefname}{الگوریتم} % used for autoref
\begin{document}
	روند \ref{alg:main1}\\
	\begin{LTR}
\begin{algorithm}
	\begin{latin}	
		\SetAlgoVlined
		\SetKwInOut{Input}{input}
		\SetKwInOut{Output}{output}
		\Input{x } 
		\Output {y } 	
		Do 1\\
		Do 2
	\end{latin}
	\begin{RTL}
		\caption{بلوک اصلی}
	\end{RTL}
	\label{alg:main1}
\end{algorithm}
	\end{LTR}
روند \ref{alg:main2}\\
	\begin{LTR}
	\begin{algorithm}
		\begin{latin}	
			\SetAlgoVlined
			\SetKwInOut{Input}{input}
			\SetKwInOut{Output}{output}
			\Input{x } 
			\Output {y } 	
			\While{is}{			
				\For{n}{
					\For {}{
						\eIf{}{
						}{
						}
					}			 		
				} 
			}
		\end{latin}
		\begin{RTL}
			\caption{بلوک اصلی}
		\end{RTL}
		\label{alg:main2}
	\end{algorithm}
\end{LTR}
		روند \ref{alg:main3}
\begin{LTR}
\begin{algorithm}
	\begin{latin}	
		\SetAlgoVlined
		\SetKwInOut{Input}{input}
		\SetKwInOut{Output}{output}
		\Input{x} 
		\Output {y} 	
		Do 1\\
		Do 2
	\end{latin}
	\begin{RTL}
		\caption{بلوک اصلی}
	\end{RTL}
	\label{alg:main3}
\end{algorithm}
\end{LTR}



\end{document}
