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 the use of ''using'' declaration in c++, A using declaration in C++...

A using declaration in C++ makes it likely to use a name from a namespace without the scope operator.

Explain turing reducibility, Explain Turing reducibility?  Exponential ...

Explain Turing reducibility?  Exponential time algorithms typically happens when we solve by searching by a space of solutions known as brute -force search

Two parallel fetch-implement, Take a CPU that shows two parallel fetch-impl...

Take a CPU that shows two parallel fetch-implement pipelines for superscalar processing. Determine the performance improvement over scalar pipeline processing and no-pipeline proce

Challenges facing operations managers - information systems, Challenges Fac...

Challenges Facing Operations Managers - Information Systems While information systems should be seen as tools that enable better performance their implementation also brings a

Rule in a single direction - equivalences rules, Rule in a single direction...

Rule in a single direction - equivalences rules: Hence there the power to replace  sub expressions always allows use to prove theorems with equivalences: as given in the above

C program, program for finding the area under the curve   #includ...

program for finding the area under the curve   #include float start_point, /* GLOBAL VARIABLES */ end_point, total_area; int

Discuss in brief the history of e-commerce, Discuss in brief the history of...

Discuss in brief the history of E-Commerce. History of E-commerce illustrated below: E-commerce began before personal computers were prevalent and has grown into a multibill

Evaluation function - canonical genetic algorithm, Evaluation function - ca...

Evaluation function - canonical genetic algorithm: However note that this termination check may be related or the same as the evaluation function - that discussed later - but

How do active web pages work, How do active web pages work? Describe with a...

How do active web pages work? Describe with a small example. Active Web Pages: An active document is not completely specified through the server. Instead an active documen

E- commerce technology and web design, In this assignment, you are required...

In this assignment, you are required to develop part of a B2C e-Commerce site which is an online movie reservation system for a multiplex theatre. Through the developed site, the u

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