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
frutty [35]
3 years ago
12

The following 2D array has been created:

Computers and Technology
2 answers:
Airida [17]3 years ago
4 0

Answer:

public class Main

{

public static void main(String[] args) {

 

 int [][] a = new int[4][5];

 

 a[0][0] = 1;

 a[0][1] = 2;

 a[0][2] = 3;

 a[0][3] = 4;

 a[0][4] = 5;

 a[1][0] = 10;

 a[1][1] = 9;

 a[1][2] = 8;

 a[1][3] = 7;

 a[1][4] = 6;

 a[2][0] = 11;

 a[2][1] = 12;

 a[2][2] = 13;

 a[2][3] = 14;

 a[2][4] = 15;

 a[3][0] = 20;

 a[3][1] = 19;

 a[3][2] = 18;

 a[3][3] = 17;

 a[3][4] = 16;

 

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

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

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

     }

     System.out.print("\n");

 }

}

}

Explanation:

  • Inside the main method, initialize the 2D array with their respective values at the appropriate indexes.
  • Iterate over the 2D array using a nested For loop.
  • The outer loop iterates over the rows, while the inner loop iterates over the columns of the 2D array respectively.
  • Finally inside the nested For loop, print the value of 2D array using the i and j index.

Output:

1 2 3 4 5

10 9 8 7 6

11 12 13 14 15

20 19 18 17 16

RSB [31]3 years ago
3 0

Answer:

I wrote this program using C# and Visual Studio. This program requires to display 2D array which has 4 rows and 5 columns. it is also noted that, this program requires to display first and third row in ascending order while second and fourth row in descending order.

To iterate through each row for loop is used and inside for loop, switch statement is used to decide on first, second, third and fourth row that is which rows should be displayed in ascending orders, and which are required to display in descending orders.

Explanation:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace _2D_Array

{

   class Program

   {

       static void Main(string[] args)

       {

           int[,] a = new int[4, 5]{

                              {1, 2, 3,4,5} ,   /*  initializers for row indexed by 0 */

            {6, 7,8,9,10} ,   /*  initializers for row indexed by 1 */

          {11,12,13,14,15},/*  initializers for row indexed by 2 */

                              { 16,17,18,19,20},/*  initializers for row indexed by 3 */

           };

           for (int row = 0; row < 4; row++)// here we iterate through each row and display the result

           {

               switch (row)//the purpose of using switch statement  is that, we will display first and 3rd row in ascending order while 2nd and 5th row in descending order

               {

                   case 0:// here to display row 1

                       {

                           for (int i = 0; i < 1; i++)

                           {

                               Console.Write("[");

                               for (int j = 0; j < 5; j++)

                                   Console.Write(a[i, j]+ (j >3 ? "" : ","));

                           }

                           Console.Write("]");

                           Console.WriteLine();

                           

                       }

                       break;

                   case 1://here to display row two

                       {

                           for (int i = 1; i < 2; i++)

                           {

                               //Console.WriteLine("row 1");

                               Console.Write("[");

                               for (int j = 4; j >= 0; j--)// to display array elements in reverse order

                               {

                                   Console.Write(a[i, j] + (j == 0 ? "" : ","));

                               }

                           }

                           Console.Write("]");

                           Console.ReadLine();

                           break;

                       }

                   case 2://here to display the 3rd row

                       {

                           for (int i = 2; i < 3; i++)

                           {

                               Console.Write("[");

                               for (int j = 0; j <5; j++)

                               {

                                   Console.Write(a[i, j] + (j > 3 ? "" : ","));

                               }

                           }

                           Console.Write("]");

                           Console.ReadLine();  

                       }

                       break;

                   case 3://here to display 4th row.  

                       {

                           for (int i = 3; i < 4; i++)

                           {

                               //Console.WriteLine("row 1");

                               Console.Write("[");

                               for (int j = 4; j >= 0; j--)

                               {

                                   Console.Write(a[i, j] + (j == 0 ? "" : ","));

                               }

                               Console.Write("]");

                           }

                           Console.ReadLine();

                       }

                       break;

               }

           }

       }

   }

}

You might be interested in
Why is musical notation important? What benefits do musicians and others receive from being able to write down and note aspects
madreJ [45]
Most importantly, musicians can share their works with others.  Other people can see their musical ideas and can try and perform them too.   Nuances such as tempo, dynamics (loud soft, sweet, "harsh", are just some examples) can be understood even if the composer is not present and there is no recording to listen to.
Financial benefits can be realized from the sale of sheet music, scoring the piece, arranging the piece for bands, orchestras, etc. Conductors can lead an entire musical ensemble through the piece. 
4 0
3 years ago
Renee uses data from the Bureau of Labor Statistics to create a graph for a feasibility report. Which of the following should sh
Lena [83]
. A source note for the data.
5 0
3 years ago
Read 2 more answers
What is computer engineering in your own words?
nordsb [41]

Answer: Computer engineering refers to the study that integrates digital engineering with computer sciences to design and develop computer structures and different technological gadgets.

Explanation:

5 0
3 years ago
Create a short document titled "Guide to web searches" that Sergio can give to users of the facility he supervises. The document
Studentka2010 [4]

Answer:

Jobs Seeker's

Web Search Guide

Sergio Escobar

PERFORMING A SEARCH:

All search engines will have a search field in which you are able to enter your search terms,

criteria, keywords, or even a website.

Search terms are the keywords a search engine will use to try to find the most relevant search

results.

If you’re looking for general information, just enter the name of the topic you’re

interested in into the search field.

So, if you’re looking for work, you can use the search terms ‘employment’ and ‘jobs’.

The search engine will return you a list of web pages that include the words

‘employment’ and ‘jobs’.

IF you’re looking for more specific information, you can narrow your search results by

using more specific search terms.

So, if you wanted employment opportunities in Phoenix, AZ, you could use the search terms:

‘local’, ‘employment’, ‘jobs’ and ‘Phoenix’.

Once you’ve entered your search terms and selected the search or go button, the search

engine will provide you with a list oF search results.

Depending on your search, you could get thousands or even millions of search results. This is

because search engines will usually list every single web page on the Internet that used those

search terms somewhere on a web page.

(However, the most current and/ or relevant results should be at the top of the list.)

Searching Strategy:

Using Boolean Operators:

use AND,OR,NOT between the words

ex: LOCAL AND JOBS

JOBS NOT IN NEWYORK

Proximity Operators:

With some search engines you can use proximity operators such as OpenText's NEAR operators or Webcrawler's ADJecent or the FOLLOWED BY operator.

With each of these operators, word order is important.

For example: if you place square brackets such as [local jobs] causes a hit if they are found within 100 words of each other.

Truncation (*)

You can use truncation on most search engines.

That is, you can use the asterisk (*) operator to end a root word.

For example: searching for comput* will find computer, computing, and computer jobs.

Note: the asterisk can not be the first or second letter of a root word.

Wildcard (?)

You can find words that share some but not all characters using the question mark (?) operator.

For example: Com?er J?b will find Computer Jobs and Computer Job.

Note: the ? can not be the first character in the search.

You may also use combinations of truncation (*) and single character wildcard (?) in your searches.

Conclusion:

These are just a few of the strategies and new tools trainers can use to make working on the web more productive.

As trainers continue to use the web they will soon see the next generation of web "knowledge tools" begin to emerge.

These will include multidimensional tools that are created to manage data on the web using factors such as "virtual neighborhoods of information,

" "organic structuring," and "mental model based searching and flying mechanisms" .

These are tools which are intended to make the world wide web more manageable for the user.

Let us now go back to my original statement...that the goals of search strategies and engines should be to increase your efficiency

and effectiveness when looking for information on the web.

Only you can decide which search/knowledge management strategies and tools actually improve your productivity.

It is my hope that this article helps you with making these decisions.

8 0
3 years ago
1. From where you can access save command?
Alja [10]

Answer:

1 no. ans

none of above

this ans is not 100% correct but also it help may help you

4 0
3 years ago
Other questions:
  • Which term describes the order of arrangement of files and folders on a computer
    11·1 answer
  • Write a paragraph on the following topic.
    14·1 answer
  • What did major networks do to combat audience erosion in the 1990s?
    15·1 answer
  • What are advantages of using document templates?
    13·2 answers
  • A user tells a help desk technician that their browser is displaying a message that a site can't be
    14·1 answer
  • Word templates include pre-made flyers which may be edited and saved only if permission is obtained from the Microsoft Office te
    11·1 answer
  • What department is cyber security
    6·2 answers
  • A motor is controlled by a logic circuit. The circuit has inputs (0 or 1) from three sensors
    8·1 answer
  • tell us things u did as a kid but don't want to admit to it (best gets brainly 5 stasr and a thank you)
    13·2 answers
  • Which two extensions in scratch are correctly matched to their accessibility goals
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!