问题:使用while
计算从m
到n
的和(m=20 、n=100):
4条回答 默认 最新
- CSDN专家-sinJack 2021-06-12 15:42关注
如有帮助,望采纳。点击我回答右上角的【采纳】按钮。
public class Test { public static void main(String[] args) { int m=20,n=100,sum=0; while(m<=n){ sum+=m; m++; } System.out.println("m到n的和为:"+sum); } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用