求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加), 几个数相加有键盘控制。 import java.util.Arrays;import java.util.Scanner;class Demo{public static void main(String[
import java.util.Arrays; import java.util.Scanner; class Demo{ public static void main(String[] args){ Scanner in = new Scanner(System.in); int sum = 0; System.out.println("input how many num to plus"); int j = in.nextInt(); System.out.println("input what num to plus"); int num = in.nextInt(); int n = 1; int[] c = new int[j]; c[0] = 1; for(int i = 1;i