FaltuTech.Club : Fane of Advanced Logical Thriving Utopian Technical Club

Draw a Pattern of Numbers and Show the Sum of Each Row and Column in Java

Pattern to be drawn



class NumberPatt{
	public static void main(String args[]){
		// declare variables to store column and rows sum
		int col=0, row=0;
		int width=9;
		int mat[][]=new int[width*2][width*2];
		for(int i=1;i0;j--){
				
				System.out.print(" ");
			}
			
			// loop for numbers
			
			for(int k=i;k>0;k--){
				row+=k;
				mat[(i-1)][(width-k)] = k; 
				System.out.print(k);
			}
			
			// loop for next numbers
			
			for(int l=2;l

Output