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 @ 2022-04-17 20:05  chenlight  阅读(2888)  评论(0)    收藏  举报