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 is line option explicit, What is line option explicit Line explici...

What is line option explicit Line explicit function makes the compiler to recognize all the variables which are not particular by the dim statement. This command significantly

Engineering and scientific software, Engineering and Scientific Software ...

Engineering and Scientific Software Engineering  and  Scientific  software  has  been  characterized  with "number crunching" algorithms. Application starts from astronomy t

What is the scope of public members in all classes, What is the Scope of pu...

What is the Scope of public/private/friend/protected/protected friend?    Scope of public/private/friend/protected/protected friend. Visual Basic/Visual C# Public/pub

Design a multiplier, how can we design a multiplier by using ASM chart and ...

how can we design a multiplier by using ASM chart and then design the data controller ?!!

8259 PIC, plz expalain interfacing of 8259 with 8085 step wise

plz expalain interfacing of 8259 with 8085 step wise

Describe the types of flip-flops and latches, Describe the types of flip-fl...

Describe the types of flip-flops and latches. Flip-flops are of two types as illustrated below: a. Positive edge triggered b.  negative edge triggered Latches are

Poor technology or system requirements definition, Poor Technology or Syste...

Poor Technology or System Requirements Definition - Information System Previously we looked at product design and specifically the importance of requirements capture as part o

What are kinds of processors, Processors can broadly be seperated into the ...

Processors can broadly be seperated into the categories of: CISC, RISC, hybrid, and special purpose.

Which header file is used for screen handling function, Which header file i...

Which header file is used for screen handling function:- The header files stdio.h having definitions of constants, macros and types, along with function declarations for stan

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