number square, Computer Engineering

Assignment Help:
Ask question #MinimYour 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.um 100 words accepted#

Related Discussions:- number square

Explain assembly program execution, Q. Explain Assembly program execution? ...

Q. Explain Assembly program execution? An assembly program is written according to a strict set of rules. A word processor or editor is used for keying an assembly program in t

State disadvantages of object oriented analysis design, State Disadvantages...

State Disadvantages of object oriented analysis design You know that OO methods only create functional models within objects. There is no place in methodology to design a compl

Observing the existing system first hand, Observing the existing system fir...

Observing the existing system first hand This involves watching personnel using the existing system to find out precisely how it works. There are a number of disadvantages as

What is meant by "method-wars" in programming, Before 1994 there were dissi...

Before 1994 there were dissimilar methodologies like Rumbaugh, Booch, Jacobson, and Meyer etc who followed their own notations to mould the systems. The developers were in a di

Explain the working of a three bit binary ripple counter, With the help of ...

With the help of clocked JK flip flops and waveforms, explain the working of a three bit binary ripple counter. Write truth table for clock transitions. Ans. Three-Bit Binary Rip

What is dithering, Q. What is Dithering? CMYK provides only 8 colours (...

Q. What is Dithering? CMYK provides only 8 colours (C, M, Y K, Violet= C + M, Orange= M + Y, Green = C + Y, and colour of paper itself!). What about other colours?  For these t

Is tcp connection-oriented?, Q. Is tcp Connection-oriented? TCP is conn...

Q. Is tcp Connection-oriented? TCP is connection-oriented. This means a connection is established between source and destination machines before any data is sent it implies tha

What are the various hazards encountered in pipelining, What is pipelining?...

What is pipelining? What are the various hazards encountered in pipelining?  Explain in detail. The major characteristics of a pipeline are: a) Pipelining cannot be exe

Write the binary representation of an integer number, The integer n = 3,510...

The integer n = 3,510,593 has hexadecimal representation 0x00359141 (check this with your d2h program), while the double precision, floating-point number 3510593.0 has hexadecimal

What is looping, What is looping Loop is a control structure used to do...

What is looping Loop is a control structure used to do repetitive operation. Some programs include repeating a set of instruction either a particular number of times or until a

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