zoukankan      html  css  js  c++  java
  • 4 随机

    package demo;
    import java.util.Scanner;
    public class Tex {
    
      public static void main(String[] args) {
    
        Scanner input = new Scanner(System.in);
        System.out.println("请输入一个0-1000之间的整数");
        int a =(int)input.nextDouble();
    
        if(a>999||a<0) {
          System.out.println("输入有误");
    
        }
        else if(a>0 && a<10){
          System.out.println("The sum of the digits is "+ a);
        }
        else if(a>9 && a<100) {
          int b=(a/10) + (a%10);
          System.out.println("The sum of the digits is "+ b);
        }    
        else if(a>99 && a<1000) {
          int c=(a/100)+(a%100)+(a%10%10); 
          System.out.println("The sum of the digits is "+ c);
        }
      }
    
    }

     

  • 相关阅读:
    第九周
    第八周
    第七周
    代码复审核查表
    对软件开发的理解
    第六周
    网站流量分析架构及实现
    hive的sql语句
    精简客户端搭建Oracle数据库
    idaa搭建maven发布tomcat
  • 原文地址:https://www.cnblogs.com/speater/p/7542688.html
Copyright © 2011-2022 走看看