int n = 10, sum;
sum = n * (n + 1) / 2;