public void Print(int Value_Enter, int RowCount) { int num, i, j, k, Value, Temp = 0, TempVal = 0; Value = Value_Enter; num = RowCount; for (i = 1; i <= num; i++) { for (j = 1; j < num - i + 1; j++) { // Console.Write(" "); } if (i == 1 || i == 2) { for (k = 1; k <= i; k++) { if (i == 1) { Console.Write(Value); } else { Console.Write(Value * 2 + (k - 1)); } Console.Write(" "); } Temp = i; TempVal = Value * 2; } else { for (k = 1; k <= Temp * 2; k++) { Console.Write((TempVal * 2) + (k - 1)); Console.Write(" "); } Temp = Temp * 2; TempVal = (TempVal * 2); } Console.WriteLine(); } Console.ReadLine(); }
Login to post response