package overLay;
import java.util.Scanner;
public class OverLay {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int num=0,num1=0,num2=0,temp=0;
System.out.println("请输入数字:");
num1=input.nextInt();
num=num1;
temp=num1;
System.out.println("请输入项数:");
num2=input.nextInt();
for (int i = 1; i <num2; i++) {
num=(num*10+num1);
temp+=num;
}
System.out.println(temp);
}
}
Java- Title: seeking s = a + aa + aaa + aaaa + aa ... the value of a, where a is a number. E.g. 2 + 22 + 222 + 2222 + 22222 (in this case the sum total of the number 5), a control keyboard a few numbers together.
Guess you like
Origin blog.csdn.net/weixin_46101839/article/details/104505421
Ranking