当前位置:网站首页>巩固-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效果

边栏推荐
猜你喜欢

Exposure: a white box photo post processing framework reading notes

redis配置环境变量

The Missing Semester

Deep understanding of grpc part1

Mechanism and type of CPU context switch

Prepare for the Blue Bridge Cup Day10__ PWM control light brightness

华为HMS Core携手超图为三维GIS注入新动能

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

Acly and metabolic diseases

CPU 上下文切换的机制和类型 (CPU Context Switch)
随机推荐
Value/hush in redis
二叉堆(一) - 原理与C实现
redis中value/hush
CPI tutorial - asynchronous interface creation and use
Extended tree (I) - concept and C implementation
Learning summary on June 30, 2022
强大、好用、适合程序员/软件开发者的专业编辑器/笔记软件综合评测和全面推荐
Skip the test cases to be executed in the unittest framework
Building external modules
想问问,证券开户有优惠吗手机开户是安全么?
Activity workflow engine
Chen Gong: Micro service, is it still so pure?
The Missing Semester
ABBIRB120工业机器人机械零点位置
今天开户今天能买股票吗?在线开户是很安全么?
自定义 grpc 插件
华为HMS Core携手超图为三维GIS注入新动能
超详细黑苹果安装图文教程送EFI配置合集及系统
redis中value/set
JS date format conversion method