import strutils import sequtils var input : int try: input = stdin.readLine.parseInt except ValueError: echo "ValueError" var loop:int var num:int #echo "input", input if input > 0: num = 0 while loop < input: loop = loop + 1 num = num + loop #echo "loop", loop #echo "num", num echo num