package com.caohao.testlnterface.SuperMan; public class lx4 { public static void main(String[] args) { //定义个变量 int sum=0; //编写for循环 for (int i=1;i<=100;i++){ //镶套for循环 for (int j=1;j<=i;j++){ //先计算一道100的和 sum+=j; } } System.out.println("求和="+sum); } }
2.编程求∑1+∑2+….+ ∑100的值
最新推荐文章于 2024-08-11 16:01:20 发布