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
Rus_ich [418]
3 years ago
10

Write an application that creates a two-dimensional array. Allow the user to input the size of the array (number of rows and num

ber of columns). Fill the array with random numbers between 0 and 100. Search the array for the largest value. Display the array values, numbers aligned, and the indexes where the largest value is stored.
Computers and Technology
1 answer:
Sindrei [870]3 years ago
4 0

Answer:

Explanation:

The Program can be computed as follows:

/*********************************************************

*Program that creates a two-dimensional array and takes an*

*Input as a size of an array and generate random elements *

**********************************************************\

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApplication 1

{

class Program

{

static void Main(string[] args)

{

int maxi=0, maxj=0;

//Random for create a random numbers.

Random rnd = new Random();

Console.WriteLine ("Enter the number of +"rows... ");

//Take a row number as a input.

int rows=Convert .Tolnt32 (Console.ReadLine

());

Console .WriteLine ("Enter the number of +

"columns ...");

//Take a column number as a input.

int cols=Convert.Tolnt32 (Console .ReadLine

());

//Declaring a two-dimensional array.

int[,] randarray = new int[rows,cols ];

//Creating an array with the random numbers.

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

{

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

//Random numbers.

randarray[i, j] = rnd.Next(0, 100);

}

}

//Assign first element of an array to the max

//Variable

int max = randarray[0,0];

//Display the elements in two-dimensional

//array

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

{

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

{

Console.Write('\n[" + i + "," +j + "]"

+"\t");

Console.Write(randarray[i, j]);

}

Console.WriteLine("\n");

}

//Checking the largest element in two-

//dimensional array.

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

{  

for (int j 0; j < cols; j++)

if (randarray[i, j] > max)

{

max = randarray[i, j];  

maxi = i;

maxj = j;

}

}

}

Console.WriteLine("The largest value is stored"

+"at ["+maxi+","+maxj+"]"+max);

Console.Read();

}

}

}  

Sample Output:

Enter the number of rows.....

2

Enter the number of columns

6

[0,0] 57

[0,1] 71

[0,2] 61

[0,3] 31

[0,4] 77

[0,5] 35

[1,0] 32

[1,1] 73

[1,2] 61

[1,3] 28

[1,4] 92

[1,5] 98

The largest value is stored at [1,5] 98

You might be interested in
I cant tell if tubbo is a bee or a goat <br>or could he be human in the smp
JulsSmile [24]

Answer:

Tubbo is a goat or ram on the Dream SMP.

Explanation:

Since Jschlatt was his father and he's a ram, Tubbo is a ram.

8 0
3 years ago
How do you put a voice password on your computer using windows 10
valkas [14]
I think you need some time of camra voice recorder sorry if im wrong also sorry cuz i forgot what it is called
7 0
3 years ago
How many websites are mobile friendly?
777dan777 [17]

Answer:

Almost 80 percent of websites are mobile friendly

Explanation:

7 0
4 years ago
Ron is in the process of designing tables for a database that will contain information for all school matches played in a year.
solong [7]
Primary Key, if we define field as primary key it will not accept duplicate values.<span>
</span>
6 0
3 years ago
When choosing a buffer to use for an experiment conducted at pH 5.3, it would be best to choose one with a pKa of: A.2.14. B.4.7
s344n2d4d5 [400]

Answer:

B.4.75

Explanation:

Buffer solutions are the solutions which can resist the change in the pH up to some extent. They are the solutions of either weak acid and conjugate base of it or weak base and conjugate acid of it.

The pH of a buffer solution can be measured by the equation known as Henderson–Hasselbalch equation.

pH=pKa+log[base]/[acid]

A good buffer that buffer which has its acid's pKa within one pH unit of desired experimental conditions.

Thus, desired pH = 5.3

Preferable pKa = 4.3 - 6.3

<u>Answer - B. 4.75</u>

7 0
4 years ago
Other questions:
  • You’ve been hired to help with installing cable at a new office building for the local branch of the Social Security Administrat
    14·1 answer
  • Why aren't the answers visible anymore? Thanks!
    8·2 answers
  • Are mechanical keyboards more expensive than membrane keyboards?
    9·2 answers
  • Mark lives in an area that is prone to tornadoes. If a tornado is headed his way, what is one thing Mark should do? A. Get in hi
    8·1 answer
  • Gwen's company is planning to accept credit cards over the Internet. Which one of the following governs this type of activity an
    13·1 answer
  • What component of a processor handles all logical comparisons and calculations inside the processor?
    9·1 answer
  • What is an appropriate action when an email thread becomes long?
    6·1 answer
  • What is Product Owner work that a Product Owner might delegate?
    10·1 answer
  • 1. what is another name for CPU?
    6·1 answer
  • If someone has the IP address 127.0.0.1 and tries to connect to the address 127.255.252.255, which are they attempting to connec
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!