
\documentclass[10pt]{article}
\pagestyle{headings}
\usepackage{fancyhdr}
\usepackage{multicol,color}
\usepackage{graphicx}
\definecolor{mycolor}{rgb}{0,.43,0}
\newcounter{question}
\newenvironment{mcquestions}{\begin{itemize}}{\end{itemize}}
\newcommand{\question}[1]{\stepcounter{question}\item[\textcolor{mycolor}{\thequestion.}] #1}
\newsavebox{\answera}
\newsavebox{\answerb}
\newsavebox{\answerc}
\newsavebox{\answerd}
\newcommand{\answer}[4]{%
\sbox\answera{#1}%
\sbox\answerb{#2}%
\sbox\answerc{#3}%
\sbox\answerd{#4}%
\ifdim\wd\answera<0.165\textwidth%
\ifdim\wd\answerb<0.165\textwidth%
\ifdim\wd\answerc<0.165\textwidth%
\ifdim\wd\answerd<0.165\textwidth%
\begin{multicols}{4}
\begin{itemize}
\item[\textcolor{mycolor}{1)}] \usebox{\answera}
\item[\textcolor{mycolor}{2)}] \usebox{\answerb}
\item[\textcolor{mycolor}{3)}] \usebox{\answerc}
\item[\textcolor{mycolor}{4)}] \usebox{\answerd}
\end{itemize}
\end{multicols}
\else%
\ifdim\wd\answera<0.4\textwidth%
\ifdim\wd\answerb<0.4\textwidth%
\ifdim\wd\answerc<0.4\textwidth%
\ifdim\wd\answerd<0.4\textwidth%
\begin{multicols}{2}
\begin{itemize}
\item[\textcolor{mycolor}{1)}] \usebox{\answera}
\item[\textcolor{mycolor}{3)}] \usebox{\answerc}
\item[\textcolor{mycolor}{2)}] \usebox{\answerb}
\item[\textcolor{mycolor}{4)}] \usebox{\answerd}
\end{itemize}
\end{multicols}
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi\fi
\else
\ifdim\wd\answera<0.4\textwidth%
\ifdim\wd\answerb<0.4\textwidth%
\ifdim\wd\answerc<0.4\textwidth%
\ifdim\wd\answerd<0.4\textwidth%
\begin{multicols}{2}
\begin{itemize}
\item[\textcolor{mycolor}{1)}] \usebox{\answera}
\item[\textcolor{mycolor}{3)}] \usebox{\answerc}
\item[\textcolor{mycolor}{2)}] \usebox{\answerb}
\item[\textcolor{mycolor}{4)}] \usebox{\answerd}
\end{itemize}
\end{multicols}
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi\fi
\else
\ifdim\wd\answera<0.4\textwidth%
\ifdim\wd\answerb<0.4\textwidth%
\ifdim\wd\answerc<0.4\textwidth%
\ifdim\wd\answerd<0.4\textwidth%
\begin{multicols}{2}
\begin{itemize}
\item[\textcolor{mycolor}{1)}] \usebox{\answera}
\item[\textcolor{mycolor}{3)}] \usebox{\answerc}
\item[\textcolor{mycolor}{2)}] \usebox{\answerb}
\item[\textcolor{mycolor}{4)}] \usebox{\answerd}
\end{itemize}
\end{multicols}
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi\fi
\else
\ifdim\wd\answera<0.4\textwidth%
\ifdim\wd\answerb<0.4\textwidth%
\ifdim\wd\answerc<0.4\textwidth%
\ifdim\wd\answerd<0.4\textwidth%
\begin{multicols}{2}
\begin{itemize}
\item[\textcolor{mycolor}{1)}] \usebox{\answera}
\item[\textcolor{mycolor}{3)}] \usebox{\answerc}
\item[\textcolor{mycolor}{2)}] \usebox{\answerb}
\item[\textcolor{mycolor}{4)}] \usebox{\answerd}
\end{itemize}
\end{multicols}
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi
\else
\begin{itemize}
\item[\textcolor{mycolor}{1)}] #1
\item[\textcolor{mycolor}{2)}] #2
\item[\textcolor{mycolor}{3)}] #3
\item[\textcolor{mycolor}{4)}] #4
\end{itemize}
\fi\fi
}

\pagenumbering{arabic}
\usepackage{xepersian}

\settextfont{XB Zar}
\setdigitfont{XB Niloofar}

           
 \pagestyle{fancy}
\cfoot{}
\lhead{\thepage}
\renewcommand{\headrulewidth}{0.4pt}

\renewcommand{\footrulewidth}{0.4pt}
\fancyhead[LE,RO]{\slshape \rightmark}

\fancyhead[LO,RE]{\slshape \leftmark}
\fancyhead[R]{فصل۱: ترکیبیات و احتمال}
\fancyfoot[C]{\thepage}
\fancyhead[L]{تهیه و تنظیم: حمیدرضا نجفی‌پور}


\begin{document}
\usepackage{tikz}
\begin{mcquestions}

\question{%
باحروف a,b,c,d,e,f چندکلمه ۴ حرفی داریم که حرف‌اول صدادار و حرف‌آخر بی‌صدا باشد؟ }
\answer{%
۴۳۲}
{%
۳۳۶}
{%
۱۴۴}
{%
۲۸۸}
\question{%
چند عدد پنج رقمی با زوج‌تا رقم زوج داریم ؟}
\answer{۳۵۰۰}{۴۰۰۰}{۴۵۰۰}{۵۰۰۰}
\question{۲۵ نقطه به طور دلخواه روی دایره قرار گرفته اند.مطلوب است حداقل تعداد کمان‌های کوچک‌تر مساوی ۱۲۰ درجه که توسط نقاط درست می‌شوند.}
\answer{۱۲۰}{۱۳۲}{۱۴۴}{۱۴۹}
\question{تعداد کلمات ۶ حرفی ساخته‌شده با حروف a,b,c که شامل تعداد زوجی حرف a باشند و از هر ۳ نوع نیز حداقل یک حرف داشته باشند، کدام است ؟‌}
\answer{۲۴۰}{۲۶۰}{۲۶۲}{۳۰۰} 
\question{به چند طریق می‌توان سه زیرمجموعه دو عضوی از مجموعه \hbox{$\{ 1,\ldots,6\}$}
انتخاب کرد به‌طوری که هر دو تا از آن‌ها دقیقأ یک عضو مشترک داشته باشند؟}
\answer{۴۰}{۵۰}{۶۰}{۸۰}
\question {از بین عدد‌های مجموعه \hbox{$\{ 1,\ldots,53\}$}حداکثر چند عدد می‌توان انتخاب کرد که تفاضل هیچ دوتایی از آن‌ها برابر ۴ نباشد؟}
\answer{۲۷}{۲۸}{۲۹}{۳۰}
\question{ می‌خواهیم خانه‌های یک مستطیل ۴×۵ را با ۴ رنگ طوری رنگ کنیم که در هر مربع ۲×۲ ، هر چهار رنگ ظاهر شود. به چند طریق }می‌توان این کار را انجام داد؟
\answer{۱۲۰}{۱۹۲}{۲۶۴}{۲۸۸}
\question {به چند طریق می‌توان در هر یک از خانه‌های یک جدول ۴×۴ یکی از دو عدد ۰ و ۱ را نوشت به طوری که مجموع اعداد در هر سطر و در هر ستون برابر ۲ شود؟}
\answer{۵۴}{۷۸}{۸۳}{۹۰}
\pagebreak
\pagestyle{empty}
\question{}
\answer{}{}{}{}
\begin{tikzpicture}

\def \n {5}
\def \radius {3cm}
\def \margin {8} % margin in angles, depends on the radius

\foreach \s in {1,...,\n}
{
  \node[draw, circle] at ({360/\n * (\s - 1)}:\radius) {$\s$};
  \draw[->, >=latex] ({360/\n * (\s - 1)+\margin}:\radius) 
    arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius);
}
\end{tikzpicture}

‎

\end{mcquestions}
\end{document}
