java 2.6
import java.util.Scanner;
public class Num
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("请输入一个大于0小于1000的数:");
int s=input.nextInt();
int x= s/100;
int y= (s/10)%10;
int z= s%10;
System.out.println("三数相加结果是:" + (x+y+z));
}
}