三章

1.计算变量b和变量c的值,并将它们的值输出到控制台上。
            试题1.1
            int a = 6;
            int b = 5;
            int c = (++b >= a) ? a*b : a/b;

            试题1.2
            int a = 6;
            int b = 5;
            bool c = a-- < b && ++a >= b;

2.计算变量b、变量b、变量c的值,并将它们的值输出到控制台上。
            试题2.1
            int a = 6;
            int b = 5;
            bool c = --a < ++b && ++a >= b;


            试题2.1
            int a = 6;
            int b = 5;
            bool c = --a < ++b || ++a >= b;

3.计算变量b、变量b、变量c的值,并将它们的值输出到控制台上。


            int a = 6;
            int b = 5;
            int c = --a < ++b || ++a >= b ? 25 : 26;


4.计算直角三角形的面积,其中两条直角边分别为5,9。

5.改造上述程序,使其两条直接边的值可以让用户从控制台输入。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            int a = 6;
            int b = 5;
            int c = (++b >= a) ? a * b : a / b;
            Console.WriteLine(b);
            Console.WriteLine(c);
            //int b = 5;
            //int c = 36;

            //int a = 6;
            //int b = 5;
            //bool c = a-- < b && ++a >= b;
            //Console.WriteLine(b);
            //Console.WriteLine(c);
            //int b = 5;
            //int c = false;


            //int a = 6;
            //int b = 5;
            //bool c = --a < ++b && ++a >= b;
            //Console.WriteLine(a);
            //Console.WriteLine(b);
            //Console.WriteLine(c);
            //int a = 6;
            //int b = 6;
            //int c = true;

 

            //int a = 6;
            //int b = 5;
            //bool c = --a < ++b || ++a >= b;
            //Console.WriteLine(a);
            //Console.WriteLine(b);
            //Console.WriteLine(c);
            //int a = 6;
            //int b = 5;
            //int c = true;

            //int a = 6;
            //int b = 5;
            //int c = --a < ++b || ++a >= b ? 25 : 26;
            //Console.WriteLine(a);
            //Console.WriteLine(b);
            //Console.WriteLine(c);
            //int a = 5;
            //int b = 6;
            //int c = 25;


           直焦三角形的底为
           // int di = 5;
           // //直角三角形的长为
           // int chang = 9;

           // //直角三角形的面积为
           // int s = (di * chang) / 2;
           // Console.WriteLine(s);


            //string a = Console.ReadLine();

            //double a1 = double.Parse(a);

            //Console.WriteLine("输入三角形的底:" + a1);

            //string b = Console.ReadLine();
            //double b1 = double.Parse(b);
            //Console.WriteLine("输入三角形的高:" + b1);

            //double s = (a1 * b1) / 2;
            //Console.WriteLine("三角形的面积:" + s);
           // Console.Read();

 


        }
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值