//8. 给定一个正整数n,求1+2+3+...+n之和并输出。
import java.util.Scanner;
public class Demo08{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个正整数:");
int n = sc.nextInt();
int sum = 0;
for(int i = 1;i<=n;i++){
sum += i;
}
System.out.print("和:"+sum);
}
}