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
1.Know the BMI of the user. First, the user will input the height in meters and weight in kilograms. After inputting, the inputt
Verizon [17]

The program that checks the BMI of a patient is given below:

<h3>THE CODE</h3>

#include <iomanip>

#include <iostream>

#include <math.h>

using namespace std;

// C++ program to illustrate

// how to calculate BMI

float BMI(float height, float weight)

{

   float bmi = weight / pow(height, 2);

   return bmi;

}

int main()

{

   float height = 1.79832;

   float weight = 70;

   // Function call

  float bmi = BMI(height, weight);

   cout << "The BMI is " << setprecision(15) << bmi

        << " so ";

   // Conditions to find out BMI category

   if (bmi < 18.5)

       cout << "underweight";

   else if (bmi >= 18.5 && bmi < 24.9)

       cout << "Healthy";

   else if (bmi >= 24.9 && bmi < 30)

       cout << "overweight";

   else if (bmi >= 30)

       cout << "Suffering from Obesity";

   return 0;

}

// This code is contributed by aarohirai2616.

<h3>Output: </h3>

The BMI is 21.64532402096181 so Healthy

Read more about algorithms here:

brainly.com/question/24953880
#SPJ1

3 0
1 year ago
Melissa is writing a class called Cell. Which method has she set up to return a double?
Alina [70]

Answer:

C. public double get_mCount()

5 0
3 years ago
Fiona is creating a presentation with PowerPoint Online about how pencils are made. She would like to type an explanation about
777dan777 [17]

Answer:THE ANSWER IS A.

Explanation:I DID IT AND I GOT 100

6 0
2 years ago
How does the Lossy file format reduce the file size?
beks73 [17]

The answer is c. I just took it on apex n that’s what I got lol

3 0
3 years ago
Read 2 more answers
Which three IP addresses may be pinged by the Test Management Network feature in the ESXi hosts DCUI
Sholpan [36]

Answer:

Primary DNS server

Secondary DNS server

Default gateway

Explanation:

The following tests are performed by ESXi:

  • Pings the subnet gateway that is stated.
  • Pings the primary DNS server that is stated.
  • Pings the secondary DNS server that is stated.
  • Ensure that the hostname of the ESXi host is resolved by it.

Based on the above, the three IP addresses may be pinged by the Test Management Network feature in the ESXi hosts DCUI are are therefore the following:

  • Primary DNS server
  • Secondary DNS server
  • Default gateway
5 0
3 years ago
Other questions:
  • What is secondary exchange ? - Apex
    14·1 answer
  • Whats the best app for cheaters​
    9·1 answer
  • How to simplify???? 2(-3x^2+6x+1)-2(4x^2-3x+1)<br><br>​
    7·1 answer
  • 01:24:3
    11·1 answer
  • Implement the Tollable interface. It provides one method, pay, that accepts an int (how many dollars to pay), and returns an int
    8·1 answer
  • Hello can you please help with this if you want to thank you!
    15·2 answers
  • A file named "games.txt" exists and has 80 lines of data. You open the file with the following line of code.
    7·2 answers
  • Sigma Technology is a company based in Singapore, with branches in 24 countries. It needs multiple CAs in different locations to
    6·1 answer
  • The following method in Inventory is intended to count how many batteries are fully charged. What should replace /*Missing Code
    15·1 answer
  • Why is it essential for every person living in the 21st century to have a computer​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!