JAVA求Sn=a+aa+aaa+(n个a)

	public static void main(String[] args) {
		int a,n,k,sum=0;
		Scanner sc = new Scanner(System.in);
		System.out.print("输入一个数a:");
		a = sc.nextInt();
		k = a;
		System.out.print("输入一个数n:");
		n = sc.nextInt();
		for (int i = 1; i <= n; i++) {
			System.out.println("i="+i+",求和a="+a);
			sum += a;
			a = a*10 + k;
			System.out.println("为下一轮循环,构造a="+a);			
		}
		System.out.println("sum="+sum);
		sc.close();
	}