zoukankan      html  css  js  c++  java
  • 第三次JAVA作业

     package pro;

    import java.util.Scanner;

    public class number {
        public static void main(String[]args){
            //从键盘读取若干整数并求和
            int nextValue;
            int sum=0;
            Scanner num = new Scanner(System.in);
            num.useDelimiter("\s");
            while(num.hasNextInt())
            {
            nextValue = num.nextInt();//读取从键盘输入的数
            sum += nextValue;
            }
            System.out.printf("Sum: %d",sum);
            num.close();

        }

    }
  • 相关阅读:
    ASP.NET 2.0
    PHP
    SQL 查询逻辑处理顺序
    LEETCODE
    网络学习课程资源
    概率论
    集合论
    图论
    《组合数学》
    离散数学
  • 原文地址:https://www.cnblogs.com/liuyajuan/p/5329891.html
Copyright © 2011-2022 走看看