my $n = ; $ans = 0; for ($ i = 0;$i <= $n;$i++) { $ans = $ans + $i; } print "$ans\n"