1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ivanshal [37]
3 years ago
13

Write a program, TwoDimentionalGrid. Ask the user to enter the size of the 2 dimensional array. Here we are not doing any input

validation. We are assuming, user is going to enter a number greater than 1. Create a 2D array with the same row and column number. Now print the array as a number grid starting at 1. Example: At place row number 3 and column number 2, number would be 6 (3*2). Any number would be the product of it's row number and column number. Hint: Use setw 5. Expected Output: Here I am attaching 2 expected output. Make sure your code is running for both input.
Computers and Technology
1 answer:
Nitella [24]3 years ago
4 0

Answer:

The program in Java is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 System.out.print("Array size: ");

 int n = input.nextInt();

 int[][] myarray = new int[n][n];

 for(int i =0;i<n;i++){

     for(int j =0;j<n;j++){

         myarray[i][j] = i * j;      }  }

 for(int i =0;i<n;i++){

     for(int j =0;j<n;j++){

         System.out.print(myarray[i][j]+" ");      }

     System.out.println();  }

}}

Explanation:

This prompts the user for the array size

 System.out.print("Array size: ");

This gets input for the array size

 int n = input.nextInt();

This declares the array

 int[][] myarray = new int[n][n];

This iterates through the rows

 for(int i =0;i<n;i++){

This iterates through the columns

     for(int j =0;j<n;j++){

This populates the array by multiplying the row and column

         myarray[i][j] = i * j;      }  }

This iterates through the rows

 for(int i =0;i<n;i++){

This iterates through the columns

     for(int j =0;j<n;j++){

This prints each array element

        System.out.print(myarray[i][j]+" ");      }

This prints a new line at the end of each row

     System.out.println();  }

}

You might be interested in
8.
IRINA_888 [86]

Answer:

local loop

Explanation:

The local loop is a term often used in computer or communication networking, which is used to describe a form of actual connection line, that joins two points; the customer's starting point and the communication carrier's end or border point.

Hence, the area that needs troubleshooting when an Internet connection problem for customers is found to be outside a carrier's regional office, is known as LOCAL LOOP.

3 0
4 years ago
Where are American poets found in the Dewey Decimal System​
Talja [164]

Answer:

The Dewey Decimal Classification (DDC) is structured around ten main classes covering the entire world of knowledge; each main class is further structured into ten hierarchical divisions, each having ten sections of increasing specificity.[1] As a system of library classification the DDC is "arranged by discipline, not subject", so a topic like clothing is classed based on its disciplinary treatment (psychological influence of clothing at 155.95, customs associated with clothing at 391, and fashion design of clothing at 746.92) within the conceptual framework.[2] The list below presents the ten main classes, hundred divisions, and thousand sections.[3]

Explanation:

7 0
3 years ago
Within a major students can choose to study a specific area within major. For example a journalism student may study military jo
crimeas [40]

Answer:

Specialization

Hope this helps!

6 0
3 years ago
_____________ consists of data that have been processed, organized, and put into context to be meaningful, and to convey underst
Lyrx [107]

Answer:Knowledge

Explanation: Knowledge is the collections of the facts , figure and related data in order to make context regarding any topic. The context of knowledge is organized and formatted in such a manner which can be understood and learnt by the individuals.It is based on the theory or any practical incident to describe the information about it.

E.g.- the remembering of any particular historic incident.

4 0
4 years ago
░░░░░░░░██████████████████
ELEN [110]

OMG YUHHH

( Also I need one more brainliset until I get expert )

7 0
3 years ago
Other questions:
  • Which of the following statements about the FAFSA process are TRUE?
    6·1 answer
  • How do you make a good title for a graph
    6·1 answer
  • How to allow a support professional to view your screen?
    6·1 answer
  • Write an expression that executes the loop body as long as the user enters a non-negative number. Note: If the submitted code ha
    10·1 answer
  • Black Ops 3 For Ps4 Players Here
    7·1 answer
  • Do the binary numbers “0011” and “000011” have the same value or different values?
    6·1 answer
  • Which of the following describes the term "false information?"
    5·1 answer
  • Explain why there is an overlap of skills and qualities in design professions​
    14·1 answer
  • Is a collection of information stored under a single nam​
    6·2 answers
  • What is gland? mention it's type​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!