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

Define the bandwidth of a monitor, Q. Define the Bandwidth of a monitor? ...

Q. Define the Bandwidth of a monitor? Bandwidth is the amount of signal the monitor can handle and it is rated in MHz .This is the most usually quoted specification of a monito

Explain about microprocessors, Q. Explain about Microprocessors? Microp...

Q. Explain about Microprocessors? Microprocessors have instruction sets ranging from 20 to several hundred instructions, known as microprograms, which are stored in ROM to init

Application and factors related to scanners, Q. Application and factors rel...

Q. Application and factors related to Scanners? When you purchase a scanner there are various factors which can be looked at: Compatibility of Scanner with your Computer, The T

General concepts of links and association, General Concepts of links and as...

General Concepts of links and association A link is a conceptual or physical connection among objects for instance. Mathematically, you can define a link as a tuple which is a

Explain call and return statements, Q. Explain Call and Return Statements? ...

Q. Explain Call and Return Statements? CALL:       CALL X    Procedure Call to procedure/function named X   CALL instruction causes the following to happen:  1.  Decre

Why erlang is used, Erlang is used to (A) Measure busy period         ...

Erlang is used to (A) Measure busy period                (B) Give total busy period in minutes (C)  Measure average call rate       (D) Indicate total call period Ans

Embedded systems and the system in which rtos is running, Explain What is t...

Explain What is the difference among embedded systems and the system in which RTOS is running? Ans) Embedded system can have RTOS and cannot have also. It depends on the requi

What is applying of an open source systems, What is applying of an Open Sou...

What is applying of an Open Source Systems?   No licensing issues No initial cost Speed of Access Openness and Transparency

Explain about iframe, Q. Explain about IFRAME? is an HTML 4.0 addition...

Q. Explain about IFRAME? is an HTML 4.0 addition to frames toolbox. Presently only MSIE supports . Unlike frames created employing and

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