string s1 = string.Empty;
string s2 = string.Empty;
for (int i = 1; i <= 9; i++)
{
s1 += new string(' ', 9);
for (int j = i; j >= 1; j--)
{
s1 += j.ToString();
s2 = j.ToString() + s2;
}
s1 += Environment.NewLine;
s2 = Environment.NewLine + new string(' ', 9 - i) + s2;
}
Console.Write(s1);
Console.Write(s2.Substring(Environment.NewLine.Length));
public class Decision {
public static void main(String[] args) {
var n = 10;
for (int i = 1; i < n; i++) {
System.out.println(tab(9) + reverseNums(i));
}
for (int i = n - 1; i > 0; i--) {
System.out.println(tab(n - i - 1) + nums(i));
}
}
private static String tab(int n) {
return " ".repeat(n);
}
private static String nums(int n) {
var sb = new StringBuilder();
for (int i = 1; i <= n; i++) {
sb.append(i);
}
return sb.toString();
}
private static String reverseNums(int n) {
var sb = new StringBuilder();
for (int i = n; i > 0; i--) {
sb.append(i);
}
return sb.toString();
}
}