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
How much memory can a 32 -bit processor support ?
JulijaS [17]

It supporst only 4 Gigabytes of memory in the system

3 0
3 years ago
An astronomer of 65 kg of mass hikes from the beach to the observatory atop the mountain in Mauna Kea, Hawaii (altitude of 4205
lara [203]

Answer:

0.845\ \text{N}

Explanation:

g = Acceleration due to gravity at sea level = 9.81\ \text{m/s}^2

R = Radius of Earth = 6371000 m

h = Altitude of observatory = 4205 m

Change in acceleration due to gravity due to change in altitude is given by

g_h=g(1+\dfrac{h}{R})^{-2}\\\Rightarrow g_h=9.81\times(1+\dfrac{4205}{6371000})^{-2}\\\Rightarrow g_h=9.797\ \text{m/s}^2

Weight at sea level

W=mg\\\Rightarrow W=65\times 9.81\\\Rightarrow W=637.65\ \text{N}

Weight at the given height

W_h=mg_h\\\Rightarrow W_h=65\times 9.797\\\Rightarrow W_h=636.805\ \text{N}

Change in weight W_h-W=636.805-637.65=-0.845\ \text{N}

Her weight reduces by 0.845\ \text{N}.

8 0
3 years ago
A commuter train traveling at 50 mi/h is 3 mi from a station. The train then decelerates so that its speed is 15 mi/h when it is
jonny [76]

Answer:

a) t = 277.477\,s\,(4.625\min), b) v_{f} = 0\,\frac{mi}{h}, c) a = -0.128\,\frac{ft}{s^{2}}

Explanation:

a) The deceleration experimented by the commuter train in the first 2.5 miles is:

a=\frac{[(15\,\frac{mi}{h} )\cdot (\frac{5280\,ft}{1\,mi} )\cdot (\frac{1\,h}{3600\,s} )]^{2}-[(50\,\frac{mi}{h} )\cdot (\frac{5280\,ft}{1\,mi} )\cdot (\frac{1\,h}{3600\,s} )]^{2}}{2\cdot (2.5\,mi)\cdot (\frac{5280\,ft}{1\,mi} )}

a = -0.185\,\frac{ft}{s^{2}}

The time required to travel is:

t = \frac{(15\,\frac{mi}{h} )\cdot (\frac{5280\,ft}{1\,fi} )\cdot(\frac{1\,h}{3600\,s} )-(50\,\frac{mi}{h} )\cdot (\frac{5280\,ft}{1\,fi} )\cdot(\frac{1\,h}{3600\,s} )}{-0.185\,\frac{ft}{s^{2}} }

t = 277.477\,s\,(4.625\min)

b) The commuter train must stop when it reaches the station to receive passengers. Hence, speed of train must be v_{f} = 0\,\frac{mi}{h}.

c) The final constant deceleration is:

a = \frac{(0\,\frac{mi}{h} )\cdot (\frac{5280\,ft}{1\,mi} )\cdot(\frac{1\,h}{3600\,s} )-(15\,\frac{mi}{h} )\cdot (\frac{5280\,ft}{1\,mi} )\cdot(\frac{1\,h}{3600\,s} )}{(2.875\,min)\cdot (\frac{60\,s}{1\,min} )}

a = -0.128\,\frac{ft}{s^{2}}

7 0
3 years ago
If my friend have the corona what do I do
nordsb [41]
(E. Call the hospital to take them away
5 0
3 years ago
Read 2 more answers
If you deposit today 11,613 in an account earning 8% compound interest, for how long should you invest the money in order to ear
Elanso [62]
Y = a (b)^t/p

y is total money

a is original amount

b is growth / decay factor

t is time

p is the frequency of every growth or decay

15131.76 = 11613 x 1.08^x

15131.76 / 11613 = 1.08^x

1.303… = 1.08^x

log1.303…. = xlog1.08

x = 3.43902165741 years
3 0
2 years ago
Other questions:
  • Give two methods on how powder is produced in powder metallurgy.
    5·2 answers
  • A rectangular block having dimensions 20 cm X 30 cm X 40 cm is subjected to a hydrostatic stress of -50 kPa (i.e. under compress
    15·1 answer
  • The velocity of a point mass that moves along the s-axis is given by s' = 40 - 3t^2 m/s, where t is in seconds. Find displacemen
    7·1 answer
  • An intranet is a restricted network that relies on Internet technologies to provide an Internet-like environment within the comp
    11·1 answer
  • Write the following statements as Prolog clauses, in the order given: If it is raining or snowing, then there is precipitation.
    15·1 answer
  • Please answwr the above question screenshot.​
    15·1 answer
  • PLEASE ANSWER THIS DIAL CALIPER
    9·1 answer
  • Diffrerentiate y=cos^{4} (3x+1)
    5·1 answer
  • A parallel circuit has a resistance of 280 and an inductive reactance of 360 02. What's this circuit's impedance?
    6·1 answer
  • Describe the meaning of the different symbols and abbreviations found on the documents that they use
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!