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
lianna [129]
1 year ago
14

Q4 a.

Engineering
1 answer:
dedylja [7]1 year ago
7 0

The Java program that accepts a matrix of M × N order and then interchanges diagonals of the matrix is given below:

<h3>Steps:  </h3>
  • 1. We can only interchange diagonals for a square matrix.
  • 2. Therefore, we would have to create a square matrix of size [M × M].
  • 3. We would check whether the matrix is a square matrix or not. If the matrix is square then follow step 3 else terminate the program.
  • 4. Apply logic for interchange diagonal of the matrix some logic is given below.

<h3>Java Code</h3>

//  Java Program to Accept a Matrix of Order M x N &

//  Interchange the Diagonals

import java.util.Scanner;

public class InterchangeDiagonals {

   public static void main(String[] args)

   {

       // declare variable

       int m, n, i, j, temp;

       // create a object of scanner class

       Scanner sc = new Scanner(System.in);

       System.out.print("Enter number of rows ");

       // take number of rows

       m = sc.nextInt();

       System.out.print("Enter number of columns ");

       // take number of columns

       n = sc.nextInt();

       // declare a mxn order array

       int a[][] = new int[m][n];

       // if block it's execute when m is equals to n

       if (m == n) {

           System.out.println(

               "Enter all the values of matrix ");

           // take the matrix inputs

           for (i = 0; i < m; i++) {

               for (j = 0; j < n; j++) {

                   a[i][j] = sc.nextInt();

               }

           }

           System.out.println("original Matrix:");

           // print the original matrix

           for (i = 0; i < m; i++) {

               for (j = 0; j < n; j++) {

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

               }

               System.out.println("");

           }

          // perform interchange

           for (j = 0; j < m; j++) {

               temp = a[j][j];

               a[j][j] = a[j][n - 1 - j];

               a[j][n - 1 - j] = temp;

           }

           System.out.println(

               " after interchanging diagonals of matrix ");

           // print interchanged matrix

           for (i = 0; i < m; i++) {

               for (j = 0; j < n; j++) {

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

               }

               System.out.println("");

           }

       }

       // else block it's only execute when m is not equals

       // to n

       else {

           System.out.println("Rows not equal to columns");

       }

   }

}

Read more about java programming here:

brainly.com/question/18554491

#SPJ1

You might be interested in
failure to yield the right-of-way to another vehicle or pedestrian is the primary Collision factor in about 20% of fatal and inj
laila [671]

You could just create a turn on green arrow. Have a button for pedestrians. The only way for them to turn is if they have a green arrow and the green arrow will only appear when pedestrians are stopped or finished walking and all cars are clear or fully stopped

8 0
4 years ago
At audio frequencies (below 20kHz), electromagnetic waves have very ____ wavelengths. The wavelength is typically much larger th
netineya [11]

Answer:

broad, transmission or power lines, electrical circuit theory

Explanation:

Electromagnetic waves have quite broad wavelengths for audio frequencies. Normally, the wavelength is larger than any of wires used in circuit. Long transmission or power line might be an exception. If the wavelength is much smaller than length of a wire, the basic principles of electronic circuits apply and the principle of electrical circuits is not needed

For wavelength much smaller than length of wire given, the given elements behave as distributed element, so for this condition Maxwell equation is apply

4 0
3 years ago
Calculate the Lee for the same wing if we increase the span to 0.245 m. By increasing the span we also increase the glider weigh
alexira [117]

Answer:

0.21

Explanation:

This would have been a fairly easy one, except for that the first part of the question is missing, and as such, I'd assume a value.

We need to use chord, so, I'm assuming the length of the chord to be 0.045 m

The Area is given by the formula

Area = span * chord

Area = 0.245 * 0.045

Area = 0.011 m²

This area gotten, is what we then divide the glider weight by to get our answer.

Lee = area / weight

Lee = 0.011 / 0.0523

Lee = 0.21

Therefore, using the values of the chord I'd assumed, the Lee of the same wing is 0.21

8 0
3 years ago
Read 2 more answers
What do electrons have to do with electrical current?
erastova [34]

Answer:

Electrons in atoms can act as our charge carrier, because every electron carries a negative charge. If we can free an electron from an atom and force it to move, we can create electricity.

6 0
4 years ago
I really need some help here!
Virty [35]

Explanation:

<h3>1.*Frame Structure have joins which keep them together whereas Shell Structure have no joins.</h3><h3>*Shell Structure usually only support their own weight whereas Frame Structure support others weight as well as themselve.</h3>
7 0
3 years ago
Other questions:
  • A higher grade number for oil means it is _____.
    6·2 answers
  • 3 If, for a particular junction, the acceptor concentration is 1017/cm3 and the donor concentration is 1016/cm3 , find the junct
    6·1 answer
  • When 2 cars a and b are next to one another, they are traveling in the same dierection with speeds va and vb, respectively. if b
    10·1 answer
  • Air at 80 °F is to flow through a 72 ft diameter pipe at an average velocity of 34 ft/s . What diameter pipe should be used to
    10·2 answers
  • The job objective on your resume should be vague so as to leave all of your options open.
    12·1 answer
  • The Kingston-Newburgh study of fluoride for the prevention of tooth decay was a community trial that was a form of what kind of
    5·1 answer
  • Show how to connect the two circuit building blocks from the previous problem to create a circuit that transforms a priority-enc
    15·1 answer
  • PLLLLLEEESSSEEE IIII NEED ASAP
    12·2 answers
  • How might a field like philosophy of history help scientists​
    14·1 answer
  • Who ate cdonalds in hell with god then died from food ppoisoning
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!