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

Can a vector have a component equivalent to zero, Q. Can a vector have a co...

Q. Can a vector have a component equivalent to zero and still have a nonzero magnitude? Answer:- Yes For example the 2-dimensional vector (1, 0) has length sqrt (1+0) = 1

Explain loop-invariant code motion, Explain briefly Loop-invariant code ...

Explain briefly Loop-invariant code motion of the commonly used code optimization techniques. Loop-invariant code motion If a quantity is calculated inside a loop duri

How e-commerce website works, Procedure The only difference between e-...

Procedure The only difference between e-commerce and conventional commerce is that goods in e-commerce are purchased over the internet using a credit card. Also buying and sel

Write unix commands, For the following, cmd1 and cmd2 are arbitrary UNIX co...

For the following, cmd1 and cmd2 are arbitrary UNIX commands, and file1 and file2 are files owned by you. Write UNIX (bash) commands to: (a) Run cmd1 and append its output to f

How is transaction processing system affected, How is Transaction Processin...

How is Transaction Processing System affect performance of e-commerce sites? Transaction Processing System influences performance of e-commerce sites: Transaction-Processing

Chemistry, application problems on electrochemical series

application problems on electrochemical series

Find out how many words can be formed from daughter, Find out how many word...

Find out how many words can be formed out of the letters of the word DAUGHTER such that (i)  The vowels are all time together. (ii)  The vowels occupy even places.   Ans:

Associative memory organisations, Associative Memory Organisations The ...

Associative Memory Organisations The associative memory is organised in w words with b bits per word. In w x b array, every bit is known a cell. Each cell is made up of a flip-

State the scope of security policy, State the scope of security policy ...

State the scope of security policy The scope of security policy depends on aspects such as the size of the Intranet site, type of information hosted on it, and the number of u

Delete a user from a category, Execute the following functionality using Ja...

Execute the following functionality using Java & SQL with simple GUI interface: 1.  Insert/delete/update an XML document.  2.  Insert/delete/update a category.  3.  Alloca

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