numbers square, Computer Engineering

Assignment Help:
Your professor wants you to fill a two-dimensional N by N matrix with some numbers by following a specific pattern. According to his explanation as in the figure below, you have to fill the whole matrix by starting from the upper left corner. And then you continue by growing the size of the square matrix one by one. You start by filling a 1 by 1 matrix, then a 2 by 2 matrix until the n by n matrix is filled.



So, in the example given above, you have to fill a 10 by 10 matrix starting from number 4. Then, you continue from the next column (downwards) and from the next row (right to left) by incrementing the number and by storing it in the current position in the array.

Question: Given the dimension of the final matrix and the starting number, print all the elements of the final matrix.

Input specification
You will be given two integer n and s ( 5 <= n <= 100 and 1 <= s <= 100 ) where n represents the dimension of the final matrix and s represents the starting number in the upper left corner.

Output specification
Show all of the elements of the final matrix separated by a single space as in the given examples.

Related Discussions:- numbers square

Trace the pseudo-code, Consider the following pseudo-code segment. 1.  i...

Consider the following pseudo-code segment. 1.  input y {y is a three-digit hexadecimal number} 2.  d ← 0 3. for i = 1 to 3      3.1. char ← i th character from y readin

Illustrate shift micro-operations, Q. Illustrate Shift Micro-operations? ...

Q. Illustrate Shift Micro-operations? Shift is a valuable operation that can be used for serial transfer of data. These operations can also be used along with other (arithmetic

Discussion., Functionality first and then Security?

Functionality first and then Security?

Difference between the fork -join and begin-end, Difference between the for...

Difference between the fork -join and begin-end. The fork - join keywords: Groups several statements together.Cause statements to be evaluated in parallel (all at the same

Determine a positive logic system logic state level, In a positive logic sy...

In a positive logic system, logic state 1 corresponds to ? Ans. For positive digital logic, we choose two voltages levels. Higher voltage shows logic 1 and a lower voltage sho

Illustration of display on video monitor, Q. Illustration of Display on Vid...

Q. Illustration of Display on Video Monitor? Displaying a single character ; display contents of BL register (Presume that it has a single character) MOV AH, 02H MOV D

How web-based word processing works, How Web-Based Word Processing Works? ...

How Web-Based Word Processing Works? Web-based word processors are hosted in the cloud, not on the hard drive-as are the documents formed with these applications. And these web

Transformation – the process of change, TRANSFORMATION - THE PROCESS OF CHA...

TRANSFORMATION - THE PROCESS OF CHANGE Much of contemporary art and design practice and indeed popular culture is dedicated to looking at how change affects us as individuals a

Scoreboards- constrained-random verification methodology, Scoreboards- Cons...

Scoreboards- Constrained-Random Verification Methodology Scoreboards are used to verify that data has successfully reached its destination whereas monitors snoop the interfaces

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd