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
HELP ME PLS ITS BEEN AN HOUR LUV U GUYS &lt;33
Setler [38]

Answer:

19.6 cubic centimeters

Step-by-step explanation:

The ratio of two similar 3D figures' volumes is equivalent to the ratio of their corresponding lengths (whether it's width, height, length, radius, etc) cubed.

Here, we know the cones are similar, and we know the smaller radius is 2 and the larger radius is 3. Then the ratio of the volume of the smaller one to the volume of the larger one is (2/3)^3=8/27.

We also know the actual volume of the larger cone is 66. So, if x is the volume of the smaller cone, we have the proportion:

x / 66 = 8 / 27

Cross-multiply:

27x = 66 * 8 = 528

Divide by 27:

x = 528/27 ≈ 19.6

The answer is thus 19.6 cubic centimeters.

<em>~ an aesthetics lover</em>

3 0
3 years ago
What expression is equivalent to 4/7+1 1/3​
omeli [17]

Answer:

1 19/21

Step-by-step explanation:

12/21+1 +7/21

19/21+1

6 0
3 years ago
Eugene went to the ice cream shop after school. The large dish of ice-
KIM [24]

Answer:

the answer would be 4

Step-by-step explanation:

10  -  4 =  6 divided by 1.25 = 4

hope this helps!

8 0
4 years ago
Read 2 more answers
PLEASE HELP ASAP!! CORRECT ANSWER ONLY PLEASE!!
yaroslaw [1]

8√(63x¹⁴y⁹) = 8√(7*9*x⁷x⁷y⁴y⁴y)=24x⁷y⁴√(7y)

Answer is D.

7 0
3 years ago
Solve the system (x-1)²+(y-2)²=2² and y=2x+2.
Likurg_2 [28]

Answer:

  (x, y) = (-0.6, 0.8)  or  (1, 4)

Step-by-step explanation:

Use the second equation to substitute for y in the first.

 (x -1)² +((2x +2) -2)² = 4

  x -2x +1 + 4x² = 4 . . . . . . . eliminate parentheses

  5x² -2x -3 = 0 . . . . . . . . . . subtract 4, collect terms

Now we can rearrange the middle term to ease factoring by grouping.

  (5x² -5x) +(3x -3) = 0

  5x(x -1) +3(x -1) = 0

  (5x +3)(x -1) = 0

The values of x that make these factors zero are ...

  x = -3/5, x = 1

The corresponding values of y are ...

  y = 2(-3/5)+2 = 4/5 . . . . for x = -3/5

  y = 2(1) +2 = 4 . . . . . . . . for x = 1

The solutions are: (x, y) = (-3/5, 4/5) or (1, 4).

___

A graphing calculator verifies these solutions.

3 0
3 years ago
Other questions:
  • Question 4 <br> please help me and show working out
    5·1 answer
  • What are expressions? Help
    5·2 answers
  • How many solutions does this equation have: -9x+1=-9x+1
    11·2 answers
  • Find the interquartile range (IQR) of the data set. 1,1,3,4,4,5,5,5,6,7,9
    7·2 answers
  • You are constructing a tangent line from a point outside a given circle to the circle. You have drawn the circle, a point outsid
    8·2 answers
  • What is the solution for the equation?-5/2=3/4+n
    10·2 answers
  • Apartment rentals in Fairview run approximately $0.90 per square foot. Jillian has determined that she can afford $630 per month
    5·1 answer
  • Wilson Swartz rents a car for 5 days at $51.29 a day and has unlimited miles. Wilson drives 198 miles and spends $29.90 on gasol
    12·1 answer
  • 4) Which transformation is the result of reflecting the original figure across the y-axis and then across the x-axis?
    9·1 answer
  • A line segment has end points R(-2, - 2) and S(4, 1). What are the coordinates of the point that is 2/3 of the way from R to S o
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!