import java.util.Scanner;
/**
* Created by mac on 2018/11/30.
*/
public class Main {
public static void main(String[]args) {
Scanner input = new Scanner(System.in);
while (input.hasNextInt()) {
int sum = input.nextInt();
//求前n项和(1+n)* n /2;
//在java计算中会考虑到/2为小数后需因int类型强制转化成整数
if ((sum % 2) == 0)
System.out.println(sum / 2 *(sum + 1));
else
System.out.println((sum + 1) / 2 * sum);
System.out.println();
}
input.close();
}
}
网友评论