zoukankan      html  css  js  c++  java
  • 作业加法

    import java.util.Scanner;

    public class MainFrame{     
    public static void main(String[]args){         //从键盘读取若干整数并求和输出        
                 int nextValue; 
                  int sum=0;
            Scanner sr = new Scanner(System.in); //设置空格为数据的分隔符
            sr.useDelimiter("\s");
                     while(sr.hasNextInt())   {     //判断有没有int型的输入
          nextValue = sr.nextInt();//读取从键盘输入的整数
            sum += nextValue;
            }
                     //System.out.println("sum:"+sum);
            System.out.printf("Sum: %d",sum);
     
            sr.close();                  
        }
    }
  • 相关阅读:
    命名规则
    数据库的基本概念(三大范式,数据)
    集合的排序
    装箱拆箱
    异常处理
    单行函数
    表管理
    创建表,插入列....
    PL/SQL 块
    单行函数的案例
  • 原文地址:https://www.cnblogs.com/cgdnf8/p/5330413.html
Copyright © 2011-2022 走看看