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

What are problems of clock skew, What are problems of clock skew? This ...

What are problems of clock skew? This is typically because of two causes. The primary is a material flaw that causes a signal to travel faster or slower than imagined. The seco

Using aspx view engine, When using aspx view engine, to have a steady look ...

When using aspx view engine, to have a steady look and feel, across all pages of the application, we can build use of asp.net master pages. What is asp.net master pages equal, when

Basic elements of assembly language, Basic elements of  Assembly language:...

Basic elements of  Assembly language: Any Assembly language which consists 3 types of instruction statements that are used to define the program operations: Data secti

What is mmu, What is MMU? MMU is the Memory Management Unit. It is a sp...

What is MMU? MMU is the Memory Management Unit. It is a special memory control circuit used for executing the mapping of the virtual address space onto the physical memory.

Search mechanisms in prolog - artificial intelligence, Search mechanisms in...

Search mechanisms in Prolog We can utilize this simple Prolog program to describe how Prolog searches: president(X) :- first_name(X, georgedubya), second_name(X, bush). p

What is grid computing, (a) What is Grid computing? (b) What are the k...

(a) What is Grid computing? (b) What are the key distinctions between conventional distributed computing and Grid computing? (b) Describe how five features of Grid Computi

How a physical addressing is performed in wan, How physical addressing is p...

How physical addressing is performed in WAN? WAN networks operate as similar to a LAN. All WAN technology classifies the exact frame format a computer uses while sending and re

Illustrate working of pocket and pc-card modems, Q. Illustrate working of P...

Q. Illustrate working of Pocket and PC-Card Modems? Pocket Modems: Small external Modems used with notebook PCs.  PC-Card Modems:  PC and Modems are read with PCMCIA slots w

What are difference between latches and flipflops, What are difference betw...

What are difference between latches and flipflops? Difference : Latches are level-sensitive, while, flipflops is edge sensitive. It means to say edge sensitive that O/p change

The three main elements of ldb, The three main elements of LDB are:- St...

The three main elements of LDB are:- Structure Selections and Database Program.

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