zoukankan      html  css  js  c++  java
  • 2.6 求整数各位数的和

    2.6

    import java.util.Scanner;

    public class test {
        public static void main(String[] args) {
            Scanner Hy=new Scanner(System.in);
            String Hyper;
            System.out.println("请输入一个0-1000的整数来求整数各位数的和");
            Hyper = Hy.nextLine();
            int test = Integer.valueOf(Hyper);
            if(test > 0 && test <= 1000) {
                int a = test % 2;
                int b = test / 10;
                int c = test / 100;
                System.out.println("总和为:" + (a + b + c));
            }
            else {
                System.out.println("完成!");
            }
    }

  • 相关阅读:
    Postfix邮件服务
    Python
    LVS
    MFS
    Apache
    Zookeeper集群 + Kafka集群 + KafkaOffsetMonitor 监控
    shell 检测安装包
    shell ssh 批量执行
    shell 判断脚本参数
    bzoj 1500 修改区间 splay
  • 原文地址:https://www.cnblogs.com/kongtingting/p/7536851.html
Copyright © 2011-2022 走看看