亚洲欧洲国产欧美一区精品,激情五月亚洲色五月,最新精品国偷自产在线婷婷,欧美婷婷丁香五月天社区

      考試首頁 | 考試用書 | 培訓(xùn)課程 | 模擬考場 | 考試論壇  
      全國  |             |          |          |          |          |         
        當(dāng)前位置:計(jì)算機(jī)等級(jí) > 二級(jí)考試 > Java語言程序設(shè)計(jì) > 模擬試題 > 文章內(nèi)容
        

      全國計(jì)算機(jī)等級(jí)考試二級(jí)Java模擬試題及答案(29)

      中華IT學(xué)院   【 】  [ 2016年11月22日 ]

      m=y-x;
      System.out.println("最大數(shù)與最小數(shù)之差為"+m);
      }else
      {
      System.out.println("最小數(shù)為"+y);
      System.out.println("最大數(shù)為"+x);
      m=x-y;
      System.out.println("最大數(shù)與最小數(shù)之差為"+m);
      }
      }
      }
      9、編寫程序,計(jì)算下列分段函數(shù)的值。
      x? (x>0)
      y=???? 0? (x=0)
      -x? (x<0)
      import java.io.*;
      public class testa
      {
      public static void main(String[] args) throws IOException
      {
      float? x,y;
      y=0;
      InputStreamReader reader=new InputStreamReader(System.in);
      BufferedReader input=new BufferedReader(reader);
      System.out.println("請(qǐng)輸入x:");
      String temp=input.readLine();
      x = Float.parseFloat(temp);
      if(x>0)
      {
      y=x;
      }
      if(x==0)
      {
      y=0;
      }
      if(x<0)
      {
      y=-x;
      }
      System.out.println("y="+y);
      }
      }
      10、編寫程序,計(jì)算下列分段函數(shù)的值。
      x-1? (x>1)
      y=???? 0? (-1≤x≤1)
      x+10? (x<-1)
      import java.io.*;
      public class testa
      {
      public static void main(String[] args) throws IOException
      {
      float? x,y;
      y=0;
      InputStreamReader reader=new InputStreamReader(System.in);
      BufferedReader input=new BufferedReader(reader);
      System.out.println("請(qǐng)輸入x:");
      String temp=input.readLine();
      x = Float.parseFloat(temp);
      if(x>1)
      {
      y=x-1;
      }
      if(1.0>=x&&x>=-1.0)
      {
      y=0;
      }
      if(x<-1)
      {
      y=x+10;
      }
      System.out.println("y="+y);
      }
      }
      首頁 1 2 尾頁
      分享到:
      本文糾錯(cuò)】【告訴好友】【打印此文】【返回頂部
      將考試網(wǎng)添加到收藏夾 | 每次上網(wǎng)自動(dòng)訪問考試網(wǎng) | 復(fù)制本頁地址,傳給QQ/MSN上的好友 | 申請(qǐng)鏈接 | 意見留言 TOP
      關(guān)于本站  網(wǎng)站聲明  廣告服務(wù)  聯(lián)系方式  站內(nèi)導(dǎo)航  考試論壇
      Copyright © 2007-2013 中華考試網(wǎng)(Examw.com) All Rights Reserved