zoukankan      html  css  js  c++  java
  • Java学习(五)

    ·计算平均成绩

    import java.io.*;

    public class AverageGrade1{
        public static void main (String args[])throws IOException{
            int score, sum;
            float avg;
            sum = 0;
            for(int i = 0;i < 5;i++){
                InputStreamReader ir;
                BufferedReader in;
                ir = new InputStreamReader(System.in);
                in = new BufferedReader(ir);
                System.out.println("Input score is:");
                String s = in.readLine();
                score = Integer.parseInt(s);
                sum = sum + score;
             }
          avg=sum/5;
          System.out.println("Average=" + avg);
          }
    }

    ·打印九九乘法表(continue)

    public class MultiList{
        public static void main (String args[]){
            for(int i = 1;i <= 9;i++){
                for(int j = 1;j <= i;j++){
                    System.out.print(j + "*" + i + "=" + j*i + " ");
                    if(i==j){
                        System.out.print(" ");
                        continue;
                    }
                }
             }
         }
    }

    ·掌握各种程序流程控制

  • 相关阅读:
    PHP将数组转换为xml
    PHP对象转数组
    MongoDB 基础命令 (MongoDB Shell)
    PHP操作Redis常用技巧
    JavaScript 表达式 Expression
    JavaScript 语句 Statement
    JavaScript 原子常量 Atom
    encodeURI()和encodeURIComponent() 区别
    Unicode 与 JavaScript 详解
    DOCKER 相关的一些用法
  • 原文地址:https://www.cnblogs.com/sheril/p/5550939.html
Copyright © 2011-2022 走看看