How to optimise my example code
So i made a programme which outputs Pascal's triangle until a certain row. The question i'm asking is whether this code is more or less optimal (length) or not and if not what can be done better. CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { Console.WriteLine("Until which row shall Pascal's triangle be created?"); int row= Convert.ToInt32( Console.ReadLine()); PasTri(row); } static void PasTri(int row){ int[,] tri= new int[row+1,row+1]; for (int i=0;i<=row;i++){ tri[i,0] =1; tri[i,i] =1; } for (int i=2;i<=row;i++){ for (int j=1; j<i;j++){ tri[i,j] =tri[i-1,j-1]+tri[i-1,j]; } } for (int i=0;i<=row;i++){ for (int j=0;j<=i;j++){ Console.Write(tri[i,j]+" "); } Console.WriteLine(); } } } }