当前位置:网站首页>巩固-C#运算符
巩固-C#运算符
2022-07-01 11:55:00 【济南医疗小程序状元】
基础入门巩固
#region 运算符 071 算术 关系 逻辑
// 算术
int suan = 1;
int suan2 = 2;
int suan3 = suan + suan2;
Console.WriteLine("运算符之算术运算符加法计算:{0}",suan3);
//比较运算符 == > <
// == 表示两边表达式运算的结果相等,注意是两个等号.
// 比如10 % 2 是一个表达式. 0 单独是一个表达式,虽然仅仅只是一个数字.
Console.WriteLine("10是否是偶数?!:"+ (10 % 2 ==0));
// 比如设计1个表达式. 5 辛巳年八月初三巳时进行起卦,具体起卦如下:上卦的求法:年数+月数+日数,其和除于八,求余数,整除时取八数. 壬 寅年 3地支数字 ,阴历6月, 数字用6,六月初三.
// 3+6+3=12 % 8 = 结果为false, 如何可以为true?
Console.WriteLine("取余计算结果:"+(12 % 8 ==0.96));
// 逻辑运算符
//【实例 2】判断 2017 年是否为闰年。
//根据题目要求,闰年的判断是需要满足两个条件中的一个,一个是年份能被 4 整数但是不能被 100 整数,一个是能被 400 整除。代码如下。
Console.WriteLine("判断2017年是否是闰年?:"+((2017 % 4 ==0 && 2017 % 100 !=0 ) || (2017 % 400 ==0)));
Console.WriteLine("判断2018年是否是闰年?:" + ((2018 % 4 == 0 && 2018 % 100 != 0) || (2018 % 400 == 0)));
#endregion效果

边栏推荐
- TMUX usage
- Theoretical basis of graph
- ACLY与代谢性疾病
- Want to ask, is there a discount for opening a securities account? Is it safe to open a mobile account?
- Acly and metabolic diseases
- Mechanism and type of CPU context switch
- 深入理解 grpc part1
- How to understand the developed query statements
- Test case writing specification in unittest framework and how to run test cases
- 【单片机】【数码管】数码管显示
猜你喜欢

Adjacency matrix undirected graph (I) - basic concepts and C language

自组织是管理者和成员的双向奔赴

Prepare for the Blue Bridge Cup Day10__ PWM control light brightness

【单片机】【数码管】数码管显示

Theoretical basis of graph

MQ prevent message loss and repeated consumption
![[MCU] [nixie tube] nixie tube display](/img/5e/9e14302b4e4f5e03601392ac90479d.png)
[MCU] [nixie tube] nixie tube display

深入理解 grpc part1

CAD如何设置标注小数位

Learning summary on June 30, 2022
随机推荐
Implementation of address book management system with C language
Summary of JFrame knowledge points 1
Talk about the pessimistic strategy that triggers full GC?
谈思生物直播—GENOVIS张洪妍抗体特异性酶切技术助力抗体药物结构表征
Xiaomi mobile phone unlocking BL tutorial
Golang introduces the implementation method of the corresponding configuration file according to the parameters
如何看懂开发的查询语句
区间乘积的因子数之和——前缀和思想+定一移二
Redis的攻击手法
Skip the test cases to be executed in the unittest framework
Istio、eBPF 和 RSocket Broker:深入研究服务网格
Why must we move from Devops to bizdevops?
Abbirb120 industrial robot mechanical zero position
Raspberry pie 4B installation tensorflow2.0[easy to understand]
MQ-防止消息丢失及重复消费
技术分享 | MySQL:从库复制半个事务会怎么样?
Mechanism and type of CPU context switch
Can I open a securities account anywhere? Is it safe to open an account
Value/list in redis
【单片机】【数码管】数码管显示