for循环练习
static void Main(string[] arg) { int intSum = 0; for (int i = 0; i <= 100; i++) { intSum += i; } Console.WriteLine(intSum); Console.ReadKey(); }
static void Main(string[] arg) { for (int i = 0; i < 100; i++) { Console.WriteLine("我下次一定小心!");//打印"我下次一定小心" } Console.ReadKey(); }
static void Main(string[] arg) { int sum = 0; for (int i = 0; i < 100; i++) { if (i%2==0) { sum += i; } } Console.WriteLine(sum); Console.ReadKey(); }