C#练习题13和14

第13题:
①让用户输入的年龄大于23(含)岁,则给用户显示你到了结婚的年龄了。
②如果老苏的(chinese music)
语文成绩大于90并且音乐成绩大于80或
语文成绩等于100并且音乐成绩大于70,则奖励100元
③让用户输入用户名和密码,如果用户名为admin,密码为mypass,则提示登陆成功。

①:

using System;

namespace 练习题13
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入你的年龄");
            int age = Convert.ToInt32(Console.ReadLine());
            if(age>=20)
            {
                Console.WriteLine("你可以结婚啦");
            }
            Console.ReadKey();
        }
    }
}

在这里插入图片描述
②:

using System;

namespace 练习题13
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入老苏的语文成绩");
            int chinese = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请输入老苏的音乐成绩");
            int music = Convert.ToInt32(Console.ReadLine());

            bool b = (chinese > 90 && music > 80) || (chinese == 100 && music > 70);

            if (b)
            {
                Console.WriteLine("奖励100元");
            }
            Console.ReadKey();
        }
    }
}

在这里插入图片描述
③:

using System;

namespace 练习题13
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入用户名");
            string name = Console.ReadLine();
            Console.WriteLine("请输入密码");
            string pwd = Console.ReadLine();


            if (name=="admin "&& pwd=="mypass")
            {
                Console.WriteLine("登录成功");
            }
            Console.ReadKey();
        }
    }
}

在这里插入图片描述

第14题:

using System;

namespace 练习题14
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入学员的考试成绩");
            int score = Convert.ToInt32(Console.ReadLine());
            if(score>=90)
            {
                Console.WriteLine("A");
            }
            else
            {
                if(score>=80)
                {
                    Console.WriteLine("B");
                }
                else
                {
                    if(score>=70)
                    {
                        Console.WriteLine("C");
                    }
                    else
                    {
                        if(score>=60)
                        {
                            Console.WriteLine("D");
                        }
                        else
                        {
                            Console.WriteLine("E");
                        }
                    }
                }
            }
            Console.ReadKey();
        }
    }
}

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值