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
Which of the following are true about the American Wire Gauge?
harina [27]

Answer:

A. smallest wire is No. 12

7 0
3 years ago
A company purchases a certain kind of electronic device from a manufacturer. The manufacturer indicates that the defective rate
olga2289 [7]

Answer:

1) The probability of at least 1 defective is approximately 45.621%

2) The probability that there will be exactly 3 shipments each containing at least 1 defective device among the 20 devices that are tested from the shipment is approximately 16.0212%

Explanation:

The given parameters are;

The defective rate of the device = 3%

Therefore, the probability that a selected device will be defective, p = 3/100

The probability of at least one defective item in 20 items inspected is given by binomial theorem as follows;

The probability that a device is mot defective, q = 1 - p = 1 - 3/100 = 97/100 = 0.97

The probability of 0 defective in 20 = ₂₀C₀(0.03)⁰·(0.97)²⁰ ≈ 0.543794342927

The probability of at least 1 = 1 - The probability of 0 defective in 20

∴ The probability of at least 1 = 1 - 0.543794342927 = 0.45621

The probability of at least 1 defective ≈ 0.45621 = 45.621%

2) The probability of at least 1 defective in a shipment, p ≈ 0.45621

Therefore, the probability of not exactly 1 defective = q = 1 - p

∴ q ≈ 1 - 0.45621 = 0.54379

The probability of exactly 3 shipment with at least 1 defective, P(Exactly 3 with at least 1) is given as follows;

P(Exactly 3 with at least 1) = ₁₀C₃(0.45621)³(0.54379)⁷ ≈ 0.160212

Therefore, the probability that there will be exactly 3 shipments each containing at least 1 defective device among the 20 devices that are tested from the shipment is 16.0212%

4 0
3 years ago
If we have silicon at 300K with 10 microns of p-type doping of 4.48*10^18/cc and 10 microns of n-type doping at 1000 times less
liq [111]

Answer:

The resistance is 24.9 Ω

Explanation:

The resistivity is equal to:

R=\frac{1}{N_{o}*u*V } =\frac{1}{4.48x10^{15}*1500*106x10^{-19}  } =0.93ohm*cm

The area is:

A = 60 * 60 = 3600 um² = 0.36x10⁻⁴cm²

w=\sqrt{\frac{2E(V_{o}-V) }{p}(\frac{1}{N_{A} }+\frac{1}{N_{D} })

If NA is greater, then, the term 1/NA can be neglected, thus the equation:

w=\sqrt{\frac{2E(V_{o}-V) }{p}(\frac{1}{N_{D} })

Where

V = 0.44 V

E = 11.68*8.85x10¹⁴ f/cm

V_{o} =\frac{KT}{p} ln(\frac{N_{A}*N_{D}}{n_{i}^{2}  } , if n_{i}=1.5x10^{10}cm^{-3}  \\V_{o}=0.02585ln(\frac{4.48x10^{18}*4.48x10^{15}  }{(1.5x10^{10})^{2}  } )=0.83V

w=\sqrt{\frac{2*11.68*8.85x10^{-14}*(0.83-0.44) }{1.6x10^{-19}*4.48x10^{15}  } } =3.35x10^{-5} cm=0.335um

The length is:

L = 10 - 0.335 = 9.665 um

The resistance is:

Re=\frac{pL}{A} =\frac{0.93*9.665x10^{-4} }{0.36x10^{-4} } =24.9ohm

7 0
3 years ago
If you are unsure about holding a piece of wood to be drilled, then you should always use a
alisha [4.7K]
C I took construction class
4 0
3 years ago
When mining diamonds with a stone pick what will be the outcome
Soloha48 [4]

Answer:

The diamond ore will break and you won't get any diamonds.

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Where Does a Solar Engineer Work? <br> (2 sentences or more please)
    14·2 answers
  • Pine Valley Furniture wants to use Internet systems to provide value to its customers and staff. There are many software technol
    5·1 answer
  • How does heat conduction differ from convection?
    6·2 answers
  • Plot the absorbance, A, versus the FeSCN2 concentration of the standard solutions (the values from your Pre-lab assignment). Fro
    7·1 answer
  • What's the difference between a GED and a Diploma?
    12·1 answer
  • 4.10.1: Simon says. "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user mu
    10·1 answer
  • What are the laws that apply to one vehicle towing another?
    11·1 answer
  • What type of engineer works to create a practical and safe energy source?
    9·1 answer
  • What type of car engine is best for cold weather.
    15·1 answer
  • 6.03 Discussion: Then &amp; Now - Safety
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!