当前位置:网站首页>巩固-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
效果
边栏推荐
- The Missing Semester
- 微信小程序开发 – 用户授权登陆「建议收藏」
- 超详细黑苹果安装图文教程送EFI配置合集及系统
- How to understand the developed query statements
- MQ prevent message loss and repeated consumption
- 分享psd格式怎么预览的方法和psd文件缩略图插件[通俗易懂]
- 深入理解 grpc part1
- Impressive bug summary (continuously updated)
- Computer graduation project asp Net hotel room management system VS development SQLSERVER database web structure c programming computer web page source code project
- 博途V15添加GSD文件
猜你喜欢
Redis的攻击手法
[MCU] [nixie tube] nixie tube display
Software project management 9.2 Software project configuration management process
Neo4j Chinese developer monthly - issue 202206
Theoretical basis of graph
Interpretation of R & D effectiveness measurement framework
ABBIRB120工业机器人机械零点位置
华为HMS Core携手超图为三维GIS注入新动能
Learning summary on June 29, 2022
S7-1500plc simulation
随机推荐
华为HMS Core携手超图为三维GIS注入新动能
The Missing Semester
241. Design priority for operational expressions: DFS application questions
区间乘积的因子数之和——前缀和思想+定一移二
8 best practices to protect your IAC security!
陈珙:微服务,它还那么纯粹吗?
241. 为运算表达式设计优先级 : DFS 运用题
Raspberry pie 4B installation tensorflow2.0[easy to understand]
S7-1500PLC仿真
Width and widthstep of iplimage
Value/string in redis
用实际例子详细探究OpenCV的轮廓检测函数findContours(),彻底搞清每个参数、每种模式的真正作用与含义
Compile and debug net6 source code
谈思生物直播—GENOVIS张洪妍抗体特异性酶切技术助力抗体药物结构表征
Comment Nike a - t - il dominé la première place toute l'année? Voici les derniers résultats financiers.
Share the method of how to preview PSD format and PSD file thumbnail plug-in [easy to understand]
Learning summary on June 30, 2022
solo 可以通过 IPV6 访问吗?
内核同步机制
用于分类任务的数据集划分脚本