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

Design a flash project, The only way to respond effectively to a design pro...

The only way to respond effectively to a design project is to first understand the topic well yourself. To do this you need to research the topic and ask yourself a series of quest

Find traffic offered and lost, Discuss grade of service. During busy hour, ...

Discuss grade of service. During busy hour, 1500 calls were offered to a group of trunks and 8 calls were lost. The average call duration was 120 seconds. Calculate the traffic off

Joint application development session leader, Q.Joint Application Developme...

Q.Joint Application Development session leader? JAD session leader: JAD leader organizes and runs the JAD. This person is trained in group management and facilitation as well

Show the simple arithmetic application, Q. Show the Simple Arithmetic Appli...

Q. Show the Simple Arithmetic Application? The question is why can't we simply employ XCHG instruction with 2 memory variables as operand? To answer the question let's look int

:P, My name is mrs flo and i apporve dubstep, do you apporve it?

My name is mrs flo and i apporve dubstep, do you apporve it?

Creation deductive inferences, Creation Deductive Inferences : Here we...

Creation Deductive Inferences : Here we have shown how knowledge can be represented in first-order logic or how rule-based expert systems expressed in logic can be constructed

State of the register, What is the state of the register in Figure  after e...

What is the state of the register in Figure  after every clock pulse if it begins in the 101001111000 state?

Signaling pvm process, Q. Signaling PVM process? int pvm_sendsig( ...

Q. Signaling PVM process? int pvm_sendsig( int tid, int signum ) Transmits a signal to other PVM process. tid is task identifier of PVM process to receive signal.

General concepts of links and association, General Concepts of links and as...

General Concepts of links and association A link is a conceptual or physical connection among objects for instance. Mathematically, you can define a link as a tuple which is a

Feature of micro-instruction execution, Q. Feature of micro-instruction exe...

Q. Feature of micro-instruction execution? Feature of micro-instruction execution is micro-instruction sequencing which involves address calculation of next micro-instruction.

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