- package org.openscience.zhoubo;
- public class TestNumberProblem {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- System.out.println(BTsum(2, 5));
- }
- public static int BTsum(int x,int plus){
- int sum = x;
- int temp = x;
- for (int i = 0; i < plus-1; i++) {
- temp = x+temp*10;
- sum+=temp;
- }
- return sum;
- }
- }
复制代码 这个代码就是你需要的 需要分析的话 再回帖,我感觉应该自己分析下流程可以看懂了~~ |