编写一段程序,运行时向用户提问“你考了多少分?(0~100)”,接受输入后判断其等级并显示出来。判断依据如下:等级={优 (90~100分);良 (80~89分);中 (60~69分);差 (0~59...

 编写一段程序,运行时向用户提问“你考了多少分?(0~100)”,接受输入后判断其等级并显示出来。判断依据如下:等级={优 (90~100分);良 (80~89分);中 (60~69分);差 (0~59分);}

 

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace 贴吧01
 8 {
 9     class Program
10     {
11         static void Main(string[] args)
12         {
13             int input;
14             //Console.WriteLine("你考了多少分?(0~100)");
15             while (true)
16             {
17                 Console.WriteLine("你考了多少分?(0~100)");
18                 input = Convert.ToInt32(Console.ReadLine());
19                 if ((input >= 90) && (input <= 100))
20                 {
21                     Console.WriteLine("");
22                     break;
23                 }
24                 else if (input >= 80)
25                 {
26                     Console.WriteLine("");
27                     break;
28                 }
29                 else if ((input >= 60) && (input <= 69))
30                 {
31                     Console.WriteLine("");
32                     break;
33                 }
34                 else if ((input >= 0) && (input <= 59)) //0-59
35                 {
36                     Console.WriteLine("");
37                     break;
38                 }
39                 else
40                 {
41                     Console.WriteLine("输入有误或者所输入的不是要求的有效成绩范围");
42                 }
43             }
44             Console.ReadKey();
45         }
46     }
47 }

 

转载于:https://www.cnblogs.com/start-from-scratch/p/4982568.html

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值