首页 > 其他 > 详细

2.6

时间:2017-09-18 12:49:09      阅读:218      评论:0      收藏:0      [点我收藏+]

java.util.Scanner;
public class Demo_1{
    public static void main(String[] agrs) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter a number 0 and 1000: ");
        int number = input.nextInt();
        int numbera = number % 10;
        int numberb = number / 10;
        int numberc= numberb % 10;
        int numberd= numberc % 10;
       
        int sum = numbera  + numberc + numberd;
        System.out.println("The sum of the digits is " + sum );
    }
}技术分享

2.6

原文:http://www.cnblogs.com/jingjing1314/p/7542457.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!