![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/d31b0ef41bd5ad6e5b29141d8acb39dbb7fd3c70?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
import java.util.Scanner;
public class Zhi2{
public static void main(String[] args){
int number = 1;
int sum = 0;
int n;
Scanner scanner = new Scanner(System.in);
n = scanner.nextInt();
for (;number<=n;number++){
sum += number;
}
System.out.println(+sum);
}
}
追问不是输入到多少的累加,就是到n的累加
本回答被提问者采纳