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

Example of shared programming using library routines, Q. Example of shared ...

Q. Example of shared programming using library routines? Think about subsequent set of statements  Process A                                  Process B                  :

Dbms, What are the disadvantages of file processing system?

What are the disadvantages of file processing system?

Atom-collider, Many physicists believe that the universe is governed by a s...

Many physicists believe that the universe is governed by a single system. A system which is capable of describing the behaviour of the very large (stars and planets) and the very s

Applications of parallel processing, Applications Of Parallel Processing ...

Applications Of Parallel Processing Parallel computing is an development of serial computing that effort to emulate what has always been the affirm of affairs in the natural wo

What is artificial intelligence robotics, Artificial Intelligence Robotics ...

Artificial Intelligence Robotics covers all the material required to understand the principles behind the AI approach to robotics and to program an artificially intelligent robot f

Which type of web document is run at the client site, Which type of web doc...

Which type of web document is run at the client site? Active web document is a type of web document is run at client side.

Multiple bus architecture - computer architecture, Multiple bus architectur...

Multiple bus architecture: One solution to the bandwidth restriction of a single bus is to simply add extra buses. Consider the architecture indicated in given figure that con

Explain about asynchronous message passing, Q. Explain about Asynchronous m...

Q. Explain about Asynchronous message passing? In Asynchronous message passing message transmitting and receiving aren't synchronized in space and time. The store and forward

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