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

Code segment , Specified  the code segment below and that n is the prob...

Specified  the code segment below and that n is the problem size, answer the following queries:   // . . . int sum = 0; if(x > 12){ for(int i = 1; i     for( i

Two different ways of building a match code object, What are the two differ...

What are the two different ways of building a match code object? A match code can be built in two dissimilar ways: Logical structure: The matchcode data is set up not pe

Give brief explanation about the keyboards, Give brief explanation about th...

Give brief explanation about the keyboards Keyboards are generally not offered as the number of options is limited and owners of the system do not want customers keying in info

What are the defining traits of an object-oriented language, The defining t...

The defining traits of an object-oriented language are: * Encapsulation * Inheritance * Polymorphism

Describe about digital audio tape, Q. Describe about Digital Audio Tape? ...

Q. Describe about Digital Audio Tape? The most proper tape for backing up data from a disk today is Digital Audio Tape (DAT). It employs a 4mm tape covered in a cartridge. It e

What is cmp instruction, What is CMP instruction Comparison instruction...

What is CMP instruction Comparison instruction (CMP) is a subtraction that changes only the flag bits; destination operand never changes. A comparison is useful for checking th

Explain about 4-bit adder-subtractor circuit, Q. Explain about 4-bit adder-...

Q. Explain about 4-bit adder-subtractor circuit? Subtraction operation on binary numbers can be obtained by succession of addition operations only it implies that to achieve su

Hard disk technology - computer architecture, Hard Disk Technology: Fi...

Hard Disk Technology: Figure of a computer hard disk drive           HDDs record data by magnetizing ferromagnetic material directionally, to represent

Illustrate header section of a device driver, Q. Illustrate Header section ...

Q. Illustrate Header section of a device driver? Header comprises information which allows DOS to identify the driver. It also comprises pointers which allow it to chain to ot

Graphic symbol of S-R flip-flop, Q. Graphic symbol of S-R flip-flop? R...

Q. Graphic symbol of S-R flip-flop? R-S Flip flop - Graphic symbol of S-R flip-flop is displayed in Fig below. It has 3 inputs S (set), R (reset) and C (for clock). Q(t+1) is

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