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

Difference between commit-work and rollback-work tasks, What is the differe...

What is the difference between Commit-work and Rollback-Work tasks? Commit-Work statement "performs" many functions relevant to synchronized execution of tasks.  Rollback-work

Compute total and access methods, Write a program that input (from the user...

Write a program that input (from the user) the number of hours worked and hours pay rate for employees and output their total pay. The program should process an arbitrary number of

How address resolution is performed with table lookup, How address resoluti...

How address resolution is performed with table lookup? Explain with the help of a suitable example. The approach of table lookup to address resolution needs a data structure wh

What happens if a function module runs in an update task, What happens if a...

What happens if a function module runs in an update task? The system performs the module processing asynchronously.  Instead of carrying out the call immediately, the system w

What is meant by hotspots, What is meant by hotspots? A Hotspot is a l...

What is meant by hotspots? A Hotspot is a list area where the mouse pointer appears as an upright hand symbol. When a user points to that area (and the hand cursor is active),

Facsimile , FACSIMILE : This is often known as 'fax' and it represents the...

FACSIMILE : This is often known as 'fax' and it represents the interface between reprographic and computer technology. By using fax, the contents of a sheet of paper (text or illu

Types of policies in e-commerce, 1- The Privacy Policy: The vendor must...

1- The Privacy Policy: The vendor must explain to the customer how all his information especially sensitive ones will be totally private, and no one can read them or use them i

What are the general security issues, What are the General Security Issues ...

What are the General Security Issues Many issues exist when linking a computer system to the Internet or indeed to an external link via a network set up. There are numerous way

What is importance of xml into edi and electronic commerce, What is the imp...

What is the importance of XML into EDI and electronic commerce? XML has been explained as lightweight SGML: XML demonstrates great promise for its inherent capability to per

Salient points about addressing mode, Salient points about addressing mode ...

Salient points about addressing mode are:  This addressing mode is employed to initialise value of a variable. Benefit of this mode is that no extra memory accesses are

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