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

Explain working of bit serial associative processor, Q. Explain working of ...

Q. Explain working of Bit Serial Associative Processor? When associative processor accepts bit serial memory organization subsequently it is known as bit serial associative pr

Combinational logic circuits, A circuit can be designed to perform manydiff...

A circuit can be designed to perform manydifferent functions e.g.a circuit has 3 inputs A, B and C and 3 outputs:Output X is logic level 1 (or 'high') if one or moreinputs are at l

On what machines matlab should be run?, Matlab will run from sthelens, and ...

Matlab will run from sthelens, and only if sthelens is down, from cher, orsay or tiree. It runs on other machines too, but some of the other machines have older versions of the OS

The current image in gimp, How do we merge an image from a file to the curr...

How do we merge an image from a file to the current image in GIMP? Ans) Use "File then Open as Layers" menu command or just take the file to a window and drop it there. The file w

What is the function of cu, What is the function of CU? The control uni...

What is the function of CU? The control unit works as the nerve center that coordinates all the computer operations. It issues timing signals that governs the data transfer.

Illustrate what is pascal''s principle, Illustrate what is pascal's princip...

Illustrate what is pascal's principle? Answer:- Pascal's Principle declares that the pressure is transmitted evenly through a liquid. That's why when you pump up a balloon

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

Give an example of first fit and best fit algorithms, Given memory partiti...

Given memory partitions of 100k, 500k, 200k, 300k, and 600k (in order), apply first fit and best fit algorithms to place processes with the space requirement of 212k, 417k, 112k an

What is port, What is port? What are the types of port available? An I/...

What is port? What are the types of port available? An I/O interface having of circuitry needed to connect an I/O device to computer bus. One side consists of a data path with

How much frequency is centered in typical human voice, Typical human voice ...

Typical human voice is centered around                   Hz. (A)  200-400                                     (B)  280-3000  (C)  400-600

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