1 //乘法表 2 for (int i = 1; i < 10; i++)//行 3 { 4 for (int j = 1; j < 10; j++)//列 5 { 6 if (j <= i) 7 { 8 Console.Write("{0}*{1}={2} ", j, i, j * i);//列在前行在后,小的在前大的在后加上制表符 9 } 10 } 11 Console.WriteLine(); 12 } 13 Console.ReadKey();
1 #region 复习冒泡排序 2 int[] arrayint = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 }; 3 for (int i = 0; i < arrayint.Length - 1; i++) 4 { 5 for (int j = 0; j < arrayint.Length - 1 - i; j++) 6 { 7 if (arrayint[j] < arrayint[j + 1]) 8 { 9 int temp = arrayint[j]; 10 arrayint[j] = arrayint[j + 1]; 11 arrayint[j + 1] = temp; 12 } 13 } 14 } 15 foreach (int item in arrayint) 16 { 17 Console.WriteLine(item); 18 } 19 Console.ReadKey(); 20 #endregion