上机练习2

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);

    }

}

posted @ 2020-03-19 11:47  吕清华  阅读(47)  评论(0编辑  收藏  举报