我又回来啦,送上我刚刚做的热乎乎的代码,仅供参考哦- int[] number={2,7,8,3,22,9};
- string a="";
- string b = "";
- for (int i = 0; i < number.Length; i++)
- {
- if (number[i] % 2 != 0)
- {
- a += number[i] + " ";
- }
- else
- {
- b += number[i] + " ";
- }
- }
- Console.WriteLine("奇数为:{0},偶数为:{1}", a, b);
复制代码 |