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
____ [38]
3 years ago
8

Given a matrix, clockwise-rotate elements in it. Please add code to problem3.cpp and the makefile. Use the code in p3 to test yo

ur code. Submit your code and a cpp.sh url, like in your projects and previous assignments. For the cpp.sh url, put your solution into one large program.
Input
1 2 4
5 7 8
3 6 9

Output:
4 1 2
7 5 3
8 9 6
Engineering
1 answer:
rusak2 [61]3 years ago
5 0

Answer:

/* C Program to rotate matrix by 90 degrees */

#include<stdio.h>

int main()

{

int matrix[100][100];

int m,n,i,j;

printf("Enter row and columns of matrix: ");

scanf("%d%d",&m,&n);

 

/* Enter m*n array elements */

printf("Enter matrix elements: \n");

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

{

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

 {

  scanf("%d",&matrix[i][j]);

 }

}

 

/* matrix after the 90 degrees rotation */

printf("Matrix after 90 degrees roration \n");

for(i=0;i<n;i++)

{

 for(j=m-1;j>=0;j--)

 {

  printf("%d  ",matrix[j][i]);

 }

 printf("\n");

}

 

return 0;

 

}

You might be interested in
An air standard cycle with constant specific heats is executed in a closed system with 0.003 kg of air and consists of the follo
Vsevolod [243]

Answer:

a) Please see attached copy below

b) 0.39KJ

c)  20.9‰

Explanation:

The three process of an air-standard cycle are described.

Assumptions

1. The air-standard assumptions are applicable.

2. Kinetic and potential energy negligible.

3. Air in an ideal gas with a constant specific heats.

Properties:

The properties of air are gotten from the steam table.

b) T₁=290K ⇒ u₁=206.91 kj/kg, h₁=290.16 kj/kg.

P₂V₂/T₂=P₁V₁/T₁⇒ T₂=P₂T₁/P₁ = 380/95(290K)= 1160K

T₃=T₂(P₃/P₂)⁽k₋1⁾/k =(1160K)(95/380)⁽⁰°⁴/₁.₄⁾ =780.6K

Qin=m(u₂₋u₁)=mCv(T₂-T₁)

=0.003kg×(0.718kj/kg.k)(1160-290)K= 1.87KJ

Qout=m(h₃₋h₁)=mCp(T₃₋T₁)

=0.003KG×(1.005kj/kg.k(780.6-290)K= 1.48KJ

Wnet, out= Qin-Qout = (1.87-1.48)KJ =0.39KJ

c)ηth= Wnet/W₍in₎ =0.39KJ/1.87KJ = 20.9‰

7 0
2 years ago
A(n) _____________ is used commonly in open split-phase motors to disconnect the start winding from the electrical circuit when
Alenkasestr [34]

A <u>centrifugal switch</u> is used commonly in open split-phase motors to disconnect the start winding from the electrical circuit when the motor reaches approximately 75% of its rated speed.

Hope that helps!

7 0
2 years ago
Oil with a density of 800 kg/m3 is pumped from a pressure of 0.6 bar to a pressure of 1.4 bar, and the outlet is 3 m above the i
Naddik [55]

Answer:

23.3808 kW

20.7088 kW

Explanation:

ρ = Density of oil = 800 kg/m³

P₁ = Initial Pressure = 0.6 bar

P₂ = Final Pressure = 1.4 bar

Q = Volumetric flow rate = 0.2 m³/s

A₁ = Area of inlet = 0.06 m²

A₂ = Area of outlet = 0.03 m²

Velocity through inlet = V₁ = Q/A₁ = 0.2/0.06 = 3.33 m/s

Velocity through outlet = V₂ = Q/A₂ = 0.2/0.03 = 6.67 m/s

Height between inlet and outlet = z₂ - z₁ = 3m

Temperature to remains constant and neglecting any heat transfer we use Bernoulli's equation

\frac {P_1}{\rho g}+\frac{V_1^2}{2g}+z_1+h=\frac {P_2}{\rho g}+\frac{V_2^2}{2g}+z_2\\\Rightarrow h=\frac{P_2-P_1}{\rho g}+\frac{V_2^2-V_1^2}{2g}+z_2-z_1\\\Rightarrow h=\frac{(1.4-0.6)\times 10^5}{800\times 9.81}+\frac{6.67_2^2-3.33^2}{2\times 9.81}+3\\\Rightarrow h=14.896\ m

Work done by pump

W_{p}=\rho gQh\\\Rightarrow W_{p}=800\times 9.81\times 0.2\times 14.896\\\Rightarrow W_{p}=23380.8\ W

∴ Power input to the pump 23.3808 kW

Now neglecting kinetic energy

h=\frac{P_2-P_1}{\rho g}+z_2-z_1\\\Righarrow h=\frac{(1.4-0.6)\times 10^5}{800\times 9.81}+3\\\Righarrow h=13.19\ m\\

Work done by pump

W_{p}=\rho gQh\\\Rightarrow W_{p}=800\times 9.81\times 0.2\times 13.193\\\Rightarrow W_{p}=20708.8\ W

∴ Power input to the pump 20.7088 kW

6 0
3 years ago
Write a SELECT statement that returns the same result set as this SELECT statement. Substitute a subquery in a WHERE clause for
sergiy2304 [10]

Answer:

SELECT distinct VendorName FROM Vendors

WHERE VendorID IN (

SELECT VendorID FROM Invoices

)

Explanation:

6 0
3 years ago
Consider the expansion of a gas at a constant temperature in a water-cooled piston-cylinder system. The constant temperature is
Leona [35]

Answer:

Q_{in} = W_{out} = nRT ln (\frac{V_{2}}{V_{1}})

Explanation:

According to the first thermodynamic law, the energy must be conserved so:

dQ = dU - dW

Where Q is the heat transmitted to the system, U is the internal energy and W is the work done by the system.

This equation can be solved by integration between an initial and a final state:

(1) \int\limits^1_2 {} \, dQ = \int\limits^1_2 {} \, dU - \int\limits^1_2 {} \, dW

As per work definition:

dW = F*dr

For pressure the force F equials the pressure multiplied by the area of the piston, and considering dx as the displacement:

dW = PA*dx

Here A*dx equals the differential volume of the piston, and considering that any increment in volume is a work done by the system, the sign is negative, so:

dW = - P*dV

So the third integral in equation (1) is:

\int\limits^1_2 {- P} \, dV

Considering the gas as ideal, the pressure can be calculated as P = \frac{n*R*T}{V}, so:

\int\limits^1_2 {- P} \, dV = \int\limits^1_2 {- \frac{n*R*T}{V}} \, dV

In this particular case as the systems is closed and the temperature constant, n, R and T are constants:

\int\limits^1_2 {- \frac{n*R*T}{V}} \, dV = -nRT \int\limits^1_2 {\frac{1}{V}} \, dV

Replacion this and solving equation (1) between state 1 and 2:

\int\limits^1_2 {} \, dQ = \int\limits^1_2 {} \, dU + nRT \int\limits^1_2 {\frac{1}{V}} \, dV

Q_{2} - Q_{1} = U_{2} - U_{1} + nRT(ln V_{2} - ln V_{1})

Q_{2} - Q_{1} = U_{2} - U_{1} + nRT ln \frac{V_{2}}{V_{1}}

The internal energy depends only on the temperature of the gas, so there is no internal energy change U_{2} - U_{1} = 0, so the heat exchanged to the system equals the work done by the system:

Q_{in} = W_{out} = nRT ln (\frac{V_{2}}{V_{1}})

4 0
3 years ago
Other questions:
  • Describe the steps, tools, and technology needed in detail and
    12·1 answer
  • Students are expected to respond to one of the two questions described below. Students should provide examples to clarify their
    12·1 answer
  • What is the difference between tension and compression?
    9·1 answer
  • The line voltage of a balanced three-phase transmission line is 4200 V rms. The transmission line has an impedance of 4 6 Z j l
    12·1 answer
  • Which of these is an example of a service job?
    7·1 answer
  • Technician a says that diesel engines can produce more power because air in fuel or not mix during the intake stroke. Technician
    9·1 answer
  • The efficiency of a steam power plant can beincreased by bleeding off some of the steam thatwould normally enter the turbine and
    15·1 answer
  • In an RL parallel circuit, VT = 240 V, R = 330 Ω, and XL = 420 Ω. What is the Apparent Power (VA)?
    9·1 answer
  • 1. A cylindrical casting is 0.3 m in diameter and 0.5 m in length. Another casting has the same metal is rectangular in cross-se
    11·1 answer
  • The side area of the door shell that is concealed when the door is closed is called the:
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!