同学,你看看红的地方
package com.chinasoft.ti;
public class MU {
/**
* @param args
*/
public static void main(String[] args) {
int Counter[];
int Sum[];
Counter=new int[40];
Sum=new int[40];
int Num=20;
int Inum;
int Jcon=39;
int n;
int m;
for(Num=20;Num>0;Num--)
{
//////
for(int i=0;i<40;i++)//初始化数组
{
Counter[i]=0;
}
Counter[Jcon]=Num;
for(Inum=1;Inum<
Num;
Inum++) //乘几次
{
for(n=0;n<40;n++)
{
Counter[n]=Counter[n]*Num;
}
for(Jcon=39;Jcon>0;Jcon--)
{
Counter[Jcon-1]=Counter[Jcon-1]+Counter[Jcon]/10;
Counter[Jcon]=Counter[Jcon]%100%10;
}
}
for(int s=39;s>=0;s--)
{
Sum[s]=Sum[s]+Counter[s];
}
for(Jcon=39;Jcon>=1;Jcon--)
{
Sum[Jcon-1]=Sum[Jcon-1]+Sum[Jcon]/10;
Sum[Jcon]=Sum[Jcon]%10;
}
for(int h=0;h<=39;h++)
{
System.out.print(Counter[h]);
}
System.out.println();
}
}
}
但是你的输出 结果是要这个吗?
0000000000000104857600000000000000000000
-306639989000000000000000000000000000000000000000
457441280000000000000000000000000000000000000000
1681328401000000000000000000000000000000000000000
0000000000000000000000000000000000000000
1500973039000000000000000000000000000000000000000
-1282129920000000000000000000000000000000000000000
-1692154371000000000000000000000000000000000000000
-251658240000000000000000000000000000000000000000
1843829075000000000000000000000000000000000000000
1410065408000000000000000000000000000000000000000
387420489000000000000000000000000000000000000000
16777216000000000000000000000000000000000000000
823543000000000000000000000000000000000000000
46656000000000000000000000000000000000000000
3125000000000000000000000000000000000000000
256000000000000000000000000000000000000000
27000000000000000000000000000000000000000
4000000000000000000000000000000000000000
1000000000000000000000000000000000000000