标签:put void ext 整数 out ann ret oid return
import java.util.Scanner;
//信1605-1 20163430 王铭宇
public class Number {
public static void main(String args[]){
Num N=new Num();
System.out.println("请输入一个整数:");
Scanner input=new Scanner(System.in);
int num=input.nextInt();
System.out.println(N.NumWeishu(num)+"位数");
}
}
class Num{
public int NumWeishu(int a){
int sum=0;
int num1;
int num2;
int weishu;
num1=a%10;
num2=a/10;
sum=sum+num1;
weishu=1;
System.out.print(num1+"\t");
while(num2!=0)
{
num1=num2%10;
num2=num2/10;
sum=sum+num1;
weishu=weishu+1;
System.out.print(num1+"\t");
}
System.out.println("求和"+sum);
return weishu;
}
}
标签:put void ext 整数 out ann ret oid return
原文地址:http://www.cnblogs.com/wmy-666/p/7645486.html