public class Main { public static void main(String[] args) { //write your code here........ long sum=0,n=0;//定义为long类型,初始化sum,n为0 for(int i=0;i<10;i++){ n=n*10+9;//生成数列 sum+=n; } System.out.println(sum); } }