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

Comparator, 6 bit magnitude comparator

6 bit magnitude comparator

What is a unix device driver, A UNIX device driver is ? Ans. A UNIX devi...

A UNIX device driver is ? Ans. A UNIX device driver is structured in two halves termed as top half and bottom half.

Electrically erasable programmable read only memory- EEPROM, Electrically e...

Electrically erasable programmable read only memory (EEPROM) An EEPROM is a special type of PROM which can be erased by exposing it to an electrical charge. Like other kinds of

Create a factory function and constructor, 1) This project will use an acco...

1) This project will use an account class that has the members: string account_code; string first_name; string last_name; double balance; Provide a constructor that

Difference between next and continue clause, The difference among the next ...

The difference among the next and continue verb is that in the continue verb it is used for a situation where there is no EOF condition that is the records are to be accessed again

What is the advantage of running the vuser as thread, VuGen gives the facil...

VuGen gives the facility to use multithreading. This enables more Vusers to be run pergenerator. If the Vuser is run as a process, the similar driver program is loaded into memory

What is collective message passing, Q. What is Collective Message Passing? ...

Q. What is Collective Message Passing? In collective message passing all the processes of a group take part in communication. MPI offers a number of functions to apply the coll

Permanently resident pages - main memory, Permanently resident pages: ...

Permanently resident pages: Every virtual memory systems have memory areas that are "pinned down", for example cannot be swapped out to secondary storage, for instance:

What is block size of cache memory, Q. What is Block size of cache memory? ...

Q. What is Block size of cache memory? Block Size: Block size means unit of data (few memory words) exchanged between main and cache memory. As block size increases from very

What is enctype, ENCTYPE="application/x-www-form-urlencoded" and in its pl...

ENCTYPE="application/x-www-form-urlencoded" and in its place use ENCTYPE="text/plain". The subsequent illustration displays a general form which includes some of the commo

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