Can anyone help please? I need to know how to make the sum of value S(n) = 0+1+2+3+4...+(n-1)+n (example: 0+1+2+3 = 6 , 0+1+2+3+4+5+6+7 = 28 and so on) on Latex
I am new in this language.
\batchmode
\documentclass{article}
\pagestyle{empty}
\usepackage{ifthen}
\newcounter{sommea}
\newcounter{sommeb}
\newcounter{compt}
\newcommand{\somme}[2]{
\setcounter{sommea}{#1}
\setcounter{sommeb}{#2}
\setcounter{compt}{0}
\sommen{#1}
}
\newcommand{\sommen}{1}{
\ifthenelse{#1 = \thecompt}{\sommeadd{#1}}{}
}
