数组: 02, 03, 05, 06, 07, 12, 01, 15,25,30`
static void Main(string[] args) {//02,03,05,06,07,12,01,15 int[] nums = { 02, 03, 05, 06, 07, 12, 01, 15,25,30 };//定义数组 for (int i = 0; inums[j+1])//冒泡,交换位置 { int temp = nums[j]; nums[j] = nums[j +1]; nums[j + 1] = temp; } } } foreach (var item in nums )//遍历输出 { Console.Write(" "+item ); } Console.ReadKey(); }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)