用while语句求1~100之和

public class Ex3_5 {
    public static void main(String[] args){
        int n=1,sum=0;
        while(n<=100)
        {
            sum+=n;
            n++;
        }
        System.out.println("sum="+sum);
    }
}

用while语句求1~100之和

用while语句求1~100之和

相关文章:

  • 2021-10-04
  • 2021-08-24
  • 2022-02-08
  • 2021-12-12
  • 2022-01-08
  • 2021-10-01
  • 2022-01-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
相关资源
相似解决方案