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

Types of structure charts, Types of Structure Charts Transaction struc...

Types of Structure Charts Transaction structure - control module calls subordinate modules, each of which handles a certain transaction More afferent processes Le

Show various RISC processors, Q. Show Various RISC Processors? RISC has...

Q. Show Various RISC Processors? RISC has fewer design bugs and its simple instructions decrease design time. Sodue to all the above important reasons RISC processors have beco

Visual basic applications in general context, Describe some general uses fo...

Describe some general uses for Visual basic applications in general context? Ans) Visual basic can be used within almost all Microsoft products such as Map point, Visio, Auto ca

Computer engineering designing, How the production of metal contributes to ...

How the production of metal contributes to computer engineering designing?

How can we decrement and increment operations, How can we decrement and in...

How can we decrement and increment  operations We  can  implement decrement  and increment  operations  by  using  a  combinational circuit  or  binary  down/up counters.  In

What is flash memory, Q. What is Flash Memory? This memory is other fo...

Q. What is Flash Memory? This memory is other form of semiconductor memory that was first introduced in mid-1980.  These memories can be reprogrammed at high speed and therefo

Delete the leaves of a binary tree, Write a recursive algorithm to delete t...

Write a recursive algorithm to delete the leaves of a binary tree. Programming Requirements You must use the binary search tree code provided.  Each algorithm must be impleme

Difference between external and global variables, Global variables are acce...

Global variables are accessible only to the batch program while external variables can be referenced from any batch program residing in the similar system library.

How to update bios chip, There are two methods to update your BIOS chip: ...

There are two methods to update your BIOS chip: 1. Flash it (software method) 2. Program it with an EEPROM programmer. This is a hardware method. This is how we at BIOSMAN pr

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