public class HelloWorld{
    public static void main(String[] args) {
        long result = 0;
        long f = 1;
        for(int i = 1; f <= 99; i++){
            result += f;
            f = f + 2;
        }
        System.out.printf("result = %d\n",result);
    }
}

计算结果

2500

相关文章:

  • 2021-10-20
  • 2021-12-23
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2022-01-17
  • 2022-12-23
猜你喜欢
  • 2021-10-28
  • 2021-05-23
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案