首页 > 其他 > 详细

读取整数

时间:2017-09-16 16:46:29      阅读:244      评论:0      收藏:0      [点我收藏+]

import java.util.Scanner;
  public class Duquzs{
  public static void main(String[] args){
    int i;
    Scanner input=new Scanner(System.in);
    System.out.print("Enter a number between 0 and 1000:");
    int t=input.nextInt();
    i=(t%10)+t/10%10+t/100%10;
    System.out.println("The sum of the digits is "+i);
  }
}

技术分享

 

读取整数

原文:http://www.cnblogs.com/xyayy/p/7531521.html

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