javaTest03

package test; import java.util.Scanner; public class Test02 { public static void main(String[] args){ int a; Scanner input=new Scanner(System.in); int sum=0; int n; System.out.println("Please input value of n:"); n=input.nextInt(); System.out.println("Please input value of a:"); a=input.nextInt(); int i; for(i=1;i<=n;i++){ sum=a+sum; a=a*10+a; } System.out.println(sum); } }

posted on 2017-11-17 20:19  哈哈呵  阅读(86)  评论(0)    收藏  举报

导航