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 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM