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
Naddika [18.5K]
3 years ago
10

Assume that a two-dimensional rectangular array of integers called matrix has been declared with six rows and eight columns. Wri

te a for loop to exchange the contents of the second column with the fifth column.
Mathematics
1 answer:
tatyana61 [14]3 years ago
5 0

Answer & Step-by-step explanation:

 //written in java

// program uses a for loop to exchange the contents of the second column with the fifth column in a six rows and eight columns array

public class Main{

   public static void main(String[] args) {

       //specifying an integer to hold values during swap

       int  value = 0;

       //sample array of

       int[][] arr = {

               {1, 2, 3, 4, 5, 6, 7, 8},

               {1, 2, 3, 4, 5, 6, 7, 8},

               {1, 2, 3, 4, 5, 6, 7, 8},

               {1, 2, 3, 4, 5, 6, 7, 8},

               {1, 2, 3, 4, 5, 6, 7, 8},

               {1, 2, 3, 4, 5, 6, 7, 8},

       };

       //loop to swap column 2 and column 5

       for (int i = 0; i < arr.length; i++) {

           for (int j = 0; j < arr[i].length; j++) {

               if(j==1){

                   value = arr[i][j];

               }

               if(j==4){

                   arr[i][1] = arr[i][j];

                   arr[i][j] = value;

               }

           }

       }

       

       //loop to print out result

       for (int[] ints : arr) {

           for (int anInt : ints) System.out.print(" " + anInt);

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

       }

   }

}

You might be interested in
Can you help me i will mark brainliest
Sonja [21]

Answer:

1. 15

2. 3

3. 4

4. 2

5. \frac{1}{8}, \frac{1}{2}, \frac{3}{4}

6. \frac{1}{4}

7. \frac{3}{8}

3 0
2 years ago
What is the approximate radius of a sphere with a volume of 1436cm to power of 3
Margarita [4]

Answer:

<h3>The radius is 7 cm</h3>

Step-by-step explanation:

Volume of a sphere is given by

V =  \frac{4}{3} \pi {r}^{3}

where r is the radius

From the question V = 1436 cm³

1436 =  \frac{4}{3} \pi {r}^{3}

Multiply through by 3

We have

4308 = 4\pi {r}^{3}

Divide both sides by 4π

{r}^{3}  =  \frac{4308}{4\pi}

{r}^{ 3}  =  \frac{1077}{\pi}

Find the cube root of both sides

r =  \sqrt[3]{ \frac{1077}{\pi} }

r = 6.99

We have the final answer as

<h3>r = 7cm</h3>

Hope this helps

3 0
3 years ago
If the length of the radius of a circle is doubled, how does that affect the circumference and area? Explain.
puteri [66]
The circumference is doubled since circumference is directly proportional to radius, and the area is quadrupled since it is directly proportional to the radius squared
8 0
3 years ago
# of yeast cells double every 4 hours how long will it take for 6billion cells
VLD [36.1K]

Answer:

60

Step-by-step explanation:

0.25

2×5

10

0.25×10

=2.5

;4×6

=24

:2.5×24

=60

6 0
3 years ago
Name the Reflection Rule that results in the following transformation
coldgirl [10]
Reflect across the x-axis because the rule is (x, -y)
4 0
3 years ago
Other questions:
  • Captain Prince already has 34 kills so far. He has been “playing” for 50 minutes. If he ends, with 146 kills, how many kills doe
    12·2 answers
  • What is the absolute value of 9.8 and -10/3
    6·2 answers
  • There are 10,000 people at a concert.
    7·1 answer
  • How do you even solve this ?
    8·1 answer
  • three times the sum of a number and 4 is 8 less then one-half the number .write and solve an equation to find the number
    10·1 answer
  • I need help ASAP it's being timed oh and I need you to show your work! I'll give brainliest!!!
    7·2 answers
  • 6th grade math help me ! :)
    8·2 answers
  • A container holds 28 cups of water. How much is this in gallons?
    12·1 answer
  • My Cours
    6·1 answer
  • Select the correct difference. -3z 5 - (-7z 5) 4 z 4 z5 -10 z5 -4 z5
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!