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

Real-time systems and control, A group report with no more than three stude...

A group report with no more than three students per group is to be handed in to explain your design procedures and simulation results. Representative graphical system outputs (clea

What are tri-state devices , why they are essential in a bus oriented syste...

why they are essential in a bus oriented system? Ans) In a multiplexed bus system, many devices are linked to a common bus. If 2 or more devices attempt to use the bus at the si

What is transformation, What is transformation? A transformation is a m...

What is transformation? A transformation is a mapping from the domain of models to the range of models. When modeling, it is significant not only to focus on customer needs, bu

Properties of vector-based graphic files, Question: a) Write a short no...

Question: a) Write a short note on each of the terminologies below pertaining to multimedia: i) Developers. ii) Users. iii) Authoring Tools. iv) Product. b) Software d

Speed up factor, Remember, the value of α is between 0 and 1. Now, let us p...

Remember, the value of α is between 0 and 1. Now, let us put some values of α and compute the speed up factor for increasing values of number of processors.  We get that the S(N) k

Database management system, what would be the occupancy of each leaf node o...

what would be the occupancy of each leaf node of a B+ tree

Explain about api s of olap, Microsoft in the late 1997 introduced a standa...

Microsoft in the late 1997 introduced a standard API called as OLE DB. After which XML was used for analysis specification and this specification was largely used by a lot of vendo

Computer graphics, what isAdvantages of scan line algorithm, Computer Graph...

what isAdvantages of scan line algorithm, Computer Graphics?

Define usb, Define USB. The Universal Serial Bus(USB) is an industry st...

Define USB. The Universal Serial Bus(USB) is an industry standard developed to give two speed of operation known as low-speed and full-speed. They provide simple, low cost and

What do you mean by first fit, What do you mean by first fit? First fi...

What do you mean by first fit? First fit allocates the first hole that is big enough. Searching can either begin at the beginning of the set of holes or where the last first-f

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