首页 > 其他分享 >if的用法

if的用法

时间:2023-12-22 11:45:33浏览次数:31  
标签:System else score && println 用法 out

if的多循环结构

public static void main(String[] args) {
       Scanner scanner = new Scanner(System.in);//创建一个扫描器对象,用于接受键盘数据
       System.out.println("请输入成绩:");
       int score = scanner.nextInt();
       if(score==100){
           System.out.println("恭喜满分");
      }else if(score>=90 && score<100){
           System.out.println("A");
      }else if(score>=80 && score<90){
           System.out.println("B");
      }else if(score>=70 && score<80){
           System.out.println("C");
      }else if(score>=60 && score<70){
           System.out.println("D");
      }else if(score>=0 && score<60){
           System.out.println("不及格");
      }else {
           System.out.println("成绩不合法");
      }
       scanner.close();
  }
 

标签:System,else,score,&&,println,用法,out
From: https://www.cnblogs.com/huangjiangfei/p/17921289.html

相关文章

  • scanner的用法
    scanner的用法定义一个scannerScannerscanner=newScanner(system.in)字符串用法publicclassDemo01{  publicstaticvoidmain(String[]args){    Scannerscanner=newScanner(System.in);//创建一个扫描器对象,用于接受键盘数据    System.out......
  • 【WPF】 BasedOn的用法
    BasedOn用于样式的继承。这里的已经继承了一个样式  此时,我们想在Resource中让他附加新的样式,但是这样不成功  修改如下:去掉了之前的样式选择  我们使用BasedOn让其叠加样式 ......
  • cjson 用法
     1、修改字典的值cJSON_SetValuestring(objectItem,value)//先获取objectTempPtr=cJSON_GetObjectItem(TempPtr,"nm");//修改该object的值cJSON_SetValuestring(TempPtr,"guxiangdehai");2、删除数组里面的值cJSON_DeleteItemFromArray(Array,index);//Array要......
  • json.NewDecode用法
    Go使用RFC3339进行编码,如果控制生成的json,只需将2022-04-03T00:00:00.000更改为2022-04-03T00:00:00.000Z。例如,这是有效的。typeContractstruct{ContractId*int`json:"contract_id"`CompanyId*int`json:"company_id"`Dat......
  • MySQL——子查询用法
    1、子查询概述子查询指一个查询语句嵌套在另一个查询语句内部的查询,内部的查询是外部查询的条件,这个特性从MySQL4.1开始引入。SQL中子查询的使用大大增强了SELECT查询的能力,因为很多时候查询需要从结果集中获取数据,或者需要从同一个表中先计算得出一个数据结果,然后与这个数据结果(可......
  • odoo rpc用法
     js /**@odoo-module**/import{registry}from"@web/core/registry";import{Layout}from"@web/search/layout";import{getDefaultConfig}from"@web/views/view";import{Component,onWillStart,useSubEnv}from&q......
  • printf, fprintf, sprintf, vsprintf, snprintf, vsnprintf之间的用法和区别
    1、printf是打印格式化字符串,返回值是成功打印的字符数;intprintf(constchar*format,...);  2、fprintf是将格式化数据写入到指定文件流中;intfprintf(FILE*stream,constchar*format,...);  3、sprintf是将格式化的数据写入到指定字符串;intsprintf(char*str,......
  • ElasticSearch中查询语句用法(match、match_phrase、multi_match、query_string)
    1、match略1.1不同字段权重如果需要为不同字段设置不同权重,可以考虑使用bool查询的should子句来组合多个match查询,并为每个match查询设置不同的权重。{"query":{"bool":{"should":[{"match":{"product_name":......
  • drf( Restful规范——序列化与反序列化——DjangoRESTframewordk用法——原生与drf实
    #Restful规范(重要-概念)```python#API接口---》后端要提供api接口---》2000年RoyFielding的博士论文中###restful是什么?REST全称是RepresentationalStateTransfer,表征性状态转移WebAPI接口的设计风格,尤其适用于前后端分离的应用模式中#有哪些规范10条 1数据的安全......
  • js中?.、??、??=的用法及使用场景
    js中?.、??、??=的用法及使用场景小熊爱敲代码征途慢慢,唯有奋斗​关注她 你经常看TA的内容  上面这个错误,相信前端开发工程师应该经常遇到吧,要么是自己考虑不全造成的,要么是后端开发人员丢失数据或者传输错误数据类型造成的。因此对数据访问......