作业.使用for语句计算8+88+888...的前10项之和

来源:互联网 发布:linux的vim配置文件 编辑:程序博客网 时间:2024/06/11 09:12
public class test1 {        public static void main(String[] args) {            long x,y=8,a=8;            for(x=1;x<10;x++) {                a=a*10+8;                y=y+a;            }            System.out.println(y);        }        }