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
A silicon diode has a saturation current of 6 nA at 25 degrees Celcius. What is the saturation current at 100 degrees Celsius?
Illusion [34]

Answer:

0.0659 A

Explanation:

Given that :

I_{0}  =  6nA ( saturation current )

at 25°c = 300 k ( room temperature )

n = 2  for silicon diode

Determine the saturation current at 100 degrees = 373 k

Diode equation at room temperature = I = Io \frac{V}{e^{0.025*n} }

next we have to determine the value of V at 373 k

q / kT = (1.6 * 10^-19) / (1.38 * 10^-23 * 373) = 31.08 V^-1

Given that I is constant

Io = \frac{e^{0.025*2} }{31.08} =  0.0659 A

3 0
3 years ago
An electric field is expressed in rectangular coordinates by E = 6x2ax + 6y ay +4az V/m.Find:a) VMN if point M and N are specifi
Fittoniya [83]

Answer:

a.) -147V

b.) -120V

c.) 51V

Explanation:

a.) Equation for potential difference is the integral of the electrical field from a to b for the voltage V_ba = V(b)-V(a).

b.) The problem becomes easier to solve if you draw out the circuit. Since potential at Q is 0, then Q is at ground. So voltage across V_MQ is the same as potential at V_M.

c.) Same process as part b. Draw out the circuit and you'll see that the potential a point V_N is the same as the voltage across V_NP added with the 2V from the other box.

Honestly, these things take practice to get used to. It's really hard to explain this.

3 0
3 years ago
Fuel filters are being replaced on a HPCR diesel
saw5 [17]

Answer:) The correct answer is B. at the end of the fuel rail.

2) The one who is correct is the Technician A.

Explanation:

7 0
3 years ago
Define the word vision statement​
Elena L [17]

Answer:

A vision statement describes what a company desires to achieve in the long-run, generally in a time frame of five to ten years, or sometimes even longer. It depicts a vision of what the company will look like in the future and sets a defined direction for the planning and execution of corporate-level strategies.

Explanation:

While companies should not be too ambitious in defining their long-term goals, it is critical to set a bigger and further target in a vision statement that communicates a company’s aspirations and motivates the audience. Below are the main elements of an effective vision statement:

-Forward-looking

-Motivating and inspirational

-Reflective of a company’s culture and core values

-Aimed at bringing benefits and improvements to the organization in the future

-Defines a company’s reason for existence and where it is heading

7 0
3 years ago
A 4KJ of energy is supplied to a machine used for lifting a mass. The force required is 800N. If the machine has an efficiency o
navik [9.2K]

The height at which the mass will be lifted is; 3 meters

<h3>How to utilize efficiency of a machine?</h3>

Formula for efficiency is;

η = useful output energy/input energy

We are given

η = 60% = 0.6

Input energy = 4 KJ = 4000 J

Thus;

0.6 = useful output energy/4000

useful output energy = 0.6 * 4000

useful output energy = 2400 J

Work done in lifting mass(useful output energy) = force * distance moved

Useful output energy = 800 * h

where h is height to lift mass

Thus;

800h = 2400

h = 2400/800

h = 3 meters

Read more about Machine Efficiency at; brainly.com/question/3617034

#SPJ1

8 0
1 year ago
Other questions:
  • the ____ method is the safest turning technique to use as it does not expose your hands to the airbags deployment area
    15·1 answer
  • During the collision, is the magnitude of the force of asteroid A on asteroid B greater than, less than, or equal to the magnitu
    11·2 answers
  • In a fluid power system, if energy is not transferred to work, what form does it take?
    6·1 answer
  • Are ocean currents always cold
    10·1 answer
  • What kind or kinds of engineers does take to design a drone and why?
    11·1 answer
  • A town is designing a rectangular, 4m deep settling tank for treating surface water intake. The tank will have a flow velocity o
    14·1 answer
  • Design a digital integrator using the impulse invariance method. Find and give a rough sketch of the amplitude response, and com
    15·1 answer
  • A continuous function y = ƒ(x) is known to be negative at x = 0 and positive at x = 1. Why does the equation ƒ(x) = 0 have at le
    14·1 answer
  • How could increasing the budget for testing have prevented the problem experienced by the mars orbiter?
    7·1 answer
  • Explain the purpose of wrench plzzz
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!