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
Consider a simple ideal Rankine cycle and an ideal regenerative Rankine cycle with one open feedwater heater. The two cycles are
borishaifa [10]

Answer:

They both have the same efficiency.

Explanation:

The simple ideal Rankine cycle and an ideal regenerative Rankine cycle with one open feedwater heater would both have the same efficiency because the extraction steam would just create a mini cycle that recirculates. The energy given to the feedwater heater is proportional to the added heat in the boiler to the feedwater in the simple cycle to raise its temperature to the same boiler inlet condition.

Therefore in comparison, the efficiency is the same for both.

4 0
3 years ago
5) /
Tpy6a [65]

Answer:

I don't understand...

4 0
3 years ago
A fluid of specific gravity 0.96 flows steadily in a long, vertical 0.71-in.-diameter pipe with an average velocity of 0.90 ft/s
KengaRu [80]

Answer:

0.00650 Ib s /ft^2

Explanation:

diameter ( D ) = 0.71 inches = 0.0591 ft

velocity = 0.90 ft/s ( V )

fluid specific gravity = 0.96 (62.4 )  ( x )

change in pressure ( P ) = 0 because pressure was constant

viscosity =  (change in p - X sin∅ ) D^{2} / 32 V

              = ( 0 - 0.96( 62.4) sin -90 ) * 0.0591 ^2  / 32 * 0.90

              = - 59.904 sin (-90) * 0.0035 / 28.8

              = 0.1874 / 28.8

  viscosity = 0.00650 Ib s /ft^2

8 0
4 years ago
Read 2 more answers
How are speed and acceleration related
erica [24]
R = distance

dr/dt speed or with a direction, velocity

d(dr/dt)/dt = the time derivative of the velocity is called acceleration.

Speed is a scalar. Acceleration is a vector.
6 0
3 years ago
Read 2 more answers
A seamless pipe 800mm diameter contains a fluid under a pressure of 2N/mm2. If the permissible tensile stress is 100N/mm2, find
Bad White [126]

Answer:

8 mm

Explanation:

Given:

Diameter, D = 800 mm

Pressure, P = 2 N/mm²

Permissible tensile stress, σ = 100 N/mm²

Now,

for the pipes, we have the relation as:

\sigma=\frac{\textup{PD}}{\textup{2t}}

where, t is the thickness

on substituting the respective values, we get

100=\frac{\textup{2\times800}}{\textup{2t}}

or

t = 8 mm

Hence, the minimum thickness of pipe is 8 mm

3 0
3 years ago
Other questions:
  • Consider two electrochemical reaqctions. Reaction A results in the transfer of 2 mol of electrons per mole of reactant and gener
    14·2 answers
  • Can anybody teach me how to make an app with flask and pygame together?​
    10·1 answer
  • A wastewater treatment plant discharges 1.0 m3/s of effluent having an ultimate BOD of 40.0 mg/ L into a stream flowingat 10.0 m
    11·1 answer
  • It is possible to have liquid water at 200°C. a)-True b)- False
    14·1 answer
  • You are analyzing an open-return wind tunnel that intakes air at 20 m/s and 320K. When the flow exits the wind tunnel it is movi
    14·2 answers
  • Parallel circuits???
    9·1 answer
  • The wave-particle duality theory is the first adequate explanation of which one of the following observations about the hydrogen
    10·1 answer
  • list out main types of material used in design and Manufacture of product give one example for each in engineering application ?
    10·1 answer
  • Kyla has obtained a bachelor’s degree in electronics engineering. In her search for a job, she comes across an advertisement tha
    11·1 answer
  • Question is written in following attached screenshot.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!