- package com.heima.lianxi;
- public class Text7_100 {
- /**
- 1+2+3+4+5+6+7+8+9+10=
- 11+12......
- */
- public static void main(String[] args) {
- int sum = 0;
- for(int i= 1;i<=100;i++){
- sum = sum +i;
- if (i%10==0) {
- System.out.println(i+"="+sum);
- sum=0;
- }else {
- System.out.print(i+"+");
- }
- }
- }
- }
复制代码 |
|