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

Show the process of message passing, Q. Show the process of message passing...

Q. Show the process of message passing? The subsequent issues are determined by system in process of message passing: 1)  Whether receiver is prepared to receive message

Derive the expression of traffic capacity, Traffic Capacity is given by? ...

Traffic Capacity is given by? Traffic Capacity = Switching capacity × Theoretical maximum load.

Characteristics of D/A converter, What are the specifications/characteristi...

What are the specifications/characteristics used by the manufacturers to describe a digital to analog converter? Explain each one briefly. Ans: D/A converter characteristics

Explain about the term- reports, Explain about the term- Reports Repor...

Explain about the term- Reports Reports are produced as a result of questions like "how many times has a type of car broken down" or "which cities have the highest house price

Determine 127.0.0.1 is which type of address, 127.0.0.1 is a? 127.0.0.1...

127.0.0.1 is a? 127.0.0.1 it is a loop-back address.

What are the process states in unix, What are the process states in Unix? ...

What are the process states in Unix? As a process implements it changes state according to its circumstances. Unix processes have the following states: Running : The process

Explain the difference between ram and rom, RAM: Read / Write memory, High ...

RAM: Read / Write memory, High Speed, Volatile Memory. ROM: Read only memory, Low Speed, Non Voliate Memory.   RAM- Random Access memory it is a Volatile Memory.  volatil

Tree strucred directory, what is the operations in atree structured directo...

what is the operations in atree structured directory.

Target_parent, TARGET = "_parent" "_parent" is used in a situation whe...

TARGET = "_parent" "_parent" is used in a situation where a frameset file is nested inside another frameset file. A link in one of the inner frameset documents that uses "_par

Special theory of relativty, michelson-morley experiment-motivation and exp...

michelson-morley experiment-motivation and experimental setup

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