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

State about the firewalls - intranet, Firewalls While getting one fire...

Firewalls While getting one firewall for the company's Intranet it should be well known that firewalls come in both hardware and software forms, and that even though all firew

Draw and illustrate the block diagram of DMA controller, Draw and illustrat...

Draw and illustrate the block diagram of DMA controller. Also discuss the various modes in which DMAC works. Direct memory access (DMA) is a process in that an external device

Maximum size of a database, What is the maximum size of a database that can...

What is the maximum size of a database that can be opened in Microsoft Access? Ans) 1 Gigabyte

Researching strategy - artificial intelligence, Researching strategy - arti...

Researching strategy - artificial intelligence: If our search and researching strategy and swot of it is surety to find all types of hints such the solutions eventually, then

Show select tag and pull down lists, The next type of input is a Pull Down ...

The next type of input is a Pull Down List. With this type you have to employ in place of and it also has a closing tag. This control is used when we have a

Computer Architecture, can u please tell me the assembly language program f...

can u please tell me the assembly language program for carry look ahead adder that can run in 8086 emulator?? its urgent

Explain mutual-exclusion implementation with semaphores, Disadvantage and...

Disadvantage and Advantage of mutual-exclusion implementation with semaphores. Disadvantage: Mutual-exclusion solutions specified by semaphores require busy waiting. Tha

What are kinds of models, What are kinds of models? Class model - Objec...

What are kinds of models? Class model - Objects in the system and their relationships. State model - Life history of the objects. Interaction model - Interactions between

How and what data is collected - weather simulation, How and what data is c...

How and what data is collected - Weather simulation -  Sensors measure pressure, relative humidity, temperature and wind speed and wind direction -  Sensors are placed in w

Define system space, Define system space.  Management routines are part...

Define system space.  Management routines are part of the operating system of the computer. It is suitable to assemble the OS routines into a virtual address space.

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