C# %取余 用法学习

复制代码
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Drawing;
 6 using System.Windows.Forms;
 7 
 8 namespace quyu
 9 {
10     class Program
11     {
12         static void Main(string[] args)
13         {
14             int a = 25;
15             int b = 4;
16             int d = 10;
17             int e = 25;
18             int f = 26;
19             int g = 30;
20             int c1,c2,c3,c4,c5;
21             c1 = b % a;
22             Console.WriteLine("4%25结果是"+c1);
23             c2 = d % a;
24             Console.WriteLine("10%25结果是" + c2);
25             c3 = e % a;
26             Console.WriteLine("25%25结果是" + c3);
27             c4 = f % a;
28             Console.WriteLine("26%25结果是" + c4);
29             c5 = g % a;
30             Console.WriteLine("30%25结果是" + c5);
31 
32         }
33     }
34 }
复制代码

 

posted @   chenlight  阅读(2740)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示