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

Trace the pseudo-code, Consider the following pseudo-code segment. 1.  i...

Consider the following pseudo-code segment. 1.  input y {y is a three-digit hexadecimal number} 2.  d ← 0 3. for i = 1 to 3      3.1. char ← i th character from y readin

Convert, haw to convert context free grammar to regular grammar

haw to convert context free grammar to regular grammar

Vector processing, Vector Processing  A vector is an ordered set of the...

Vector Processing  A vector is an ordered set of the similar type of scalar data items. The scalar item can be a floating point number, a logical value or an integer. Vector pr

Data structure, Sort the following list using selection sort technique, dis...

Sort the following list using selection sort technique, displaying each step. 20,12,25,6,10,15,13

What is usb, What is USB USB (UNIVERSAL SERIAL BUS) is intended to conn...

What is USB USB (UNIVERSAL SERIAL BUS) is intended to connect peripheral devices like mouse, keyboards, modems and sound cards to microprocessor through a serial data path and

Illustrate shift micro-operations, Q. Illustrate Shift Micro-operations? ...

Q. Illustrate Shift Micro-operations? Shift is a valuable operation that can be used for serial transfer of data. These operations can also be used along with other (arithmetic

Specifying the problem - learning decision trees, Specifying the Problem: ...

Specifying the Problem: Now next here furtherly we now use to look at how you mentally constructed your decision tree where deciding what to do at the weekend. But if one way

Microprocessor, can i get the comparison of microprocessors architecture?

can i get the comparison of microprocessors architecture?

Illustration of parallel programming environments, Q. Illustration of paral...

Q. Illustration of parallel programming environments? Let's discuss illustrations of parallel programming environments of Intel paragaon XP/S and Cray Y-MP software. The Cra

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