public class lqh { public static void main(String[] args) { // TODO Auto-generated method stub int a=1000; int b,c,d,e,sum; e=a/1000; b=a/100%10; c=a/10%10; d=a%10; sum=b+c+d+e; System.out.println("结果为"+sum); } }