Sasha likes exploring diverse mathematical articles, for instance, wizardry squares. However, Sasha comprehends that enchanted squares have as of now been examined by many individuals, so he sees no feeling of concentrating on them further. All things considered, he designed his own kind of square — a superb square.    A square of size n×n is called prime if the accompanying three conditions are held all the while:    all numbers on the square are non-negative integers not surpassing 105;    there are no indivisible numbers in the square;    amounts of integers in each line and every segment are indivisible numbers.    Sasha has an integer n. He requests you to view as any great square from size n×n. Sasha is certain beyond a shadow of a doubt such squares exist, so help him!    Input    The principal line contains a solitary integer t (1≤t≤10) — the number of experiments.    Every one of the following t lines contains a solitary integer n (2≤n≤100) — the necessary size of a square.    Output    For each experiment print n lines, each containing n integers — the superb square you fabricated. In case there are different replies, print any.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section: Chapter Questions
Problem 14PP
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Don't submit random answer. Computer science.

Sasha likes exploring diverse mathematical articles, for instance, wizardry squares. However, Sasha comprehends that enchanted squares have as of now been examined by many individuals, so he sees no feeling of concentrating on them further. All things considered, he designed his own kind of square — a superb square. 

 

A square of size n×n is called prime if the accompanying three conditions are held all the while: 

 

all numbers on the square are non-negative integers not surpassing 105; 

 

there are no indivisible numbers in the square; 

 

amounts of integers in each line and every segment are indivisible numbers. 

 

Sasha has an integer n. He requests you to view as any great square from size n×n. Sasha is certain beyond a shadow of a doubt such squares exist, so help him! 

 

Input 

 

The principal line contains a solitary integer t (1≤t≤10) — the number of experiments. 

 

Every one of the following t lines contains a solitary integer n (2≤n≤100) — the necessary size of a square. 

 

Output 

 

For each experiment print n lines, each containing n integers — the superb square you fabricated. In case there are different replies, print any.

 

 

Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr