标签:void ati ima win rgs logs power vax png
import javax.swing.JOptionPane;
public class Add {
public static void main(String[] args) {
String str=JOptionPane.showInputDialog("输入一个数");
int n,number,power,j,sum,i;
number=Integer.parseInt(str);
power=1;
i=0;
sum=0;
j=number;
while( j!=0 )
{
power=power*10;
j=j/10;
i=i+1;
}
power=power/10;
System.out.println(i+"位数字是:");
while( power>=1 )
{
n=number/power;
System.out.println(n);
sum=sum+n;
number%=power;
power/=10;
}
System.out.println("和是"+sum);
}
}
标签:void ati ima win rgs logs power vax png
原文地址:http://www.cnblogs.com/199788zxt/p/7644644.html