# Answer to Question #4860 in C++ for Patricia

Question #4860

a. Prompt the user to enter 9 numbers (type float) and store them into a 3 x 3 array.

b. Determine the smallest among the 9 numbers and print it in the main function.

c. Determine the transpose of the original matrix and then find the sum of the original and transposed matrix and print the result in this function.

b. Determine the smallest among the 9 numbers and print it in the main function.

c. Determine the transpose of the original matrix and then find the sum of the original and transposed matrix and print the result in this function.

Expert's answer

#include <iostream.h>

#include <conio.h>

main(){

float A[3][3], AT[3][3];

int i,j,s;

cout<<"Enter nine numbers:";

for (i=0;i<=2;i++){

& for (j=0;j<=2;j++){

cin>>A[i][j];

}

& }

//determining the smallest number:

s = A[0][0];

for (i=0;i<=2;i++){

& for (j=0;j<=2;j++){

if (A[i][j]<s) s=A[i][j];

}

& }

cout<<"The smallest number is "<<s<<"\r\n";

//transposing A into AT:

for (i=0;i<=2;i++){

& for (j=0;j<=2;j++){

AT[j][i]=A[i][j];

}

& }

//summing A and AT:

for (i=0;i<=2;i++){

& for (j=0;j<=2;j++){

A[i][j]=A[i][j]+AT[i][j];

}

& }

//printing:

for (i=0;i<=2;i++){

& for (j=0;j<=2;j++){

cout<<A[i][j]<<"& quot;;

}

& cout<<"\r\n";

& }

getch();

}

#include <conio.h>

main(){

float A[3][3], AT[3][3];

int i,j,s;

cout<<"Enter nine numbers:";

for (i=0;i<=2;i++){

& for (j=0;j<=2;j++){

cin>>A[i][j];

}

& }

//determining the smallest number:

s = A[0][0];

for (i=0;i<=2;i++){

& for (j=0;j<=2;j++){

if (A[i][j]<s) s=A[i][j];

}

& }

cout<<"The smallest number is "<<s<<"\r\n";

//transposing A into AT:

for (i=0;i<=2;i++){

& for (j=0;j<=2;j++){

AT[j][i]=A[i][j];

}

& }

//summing A and AT:

for (i=0;i<=2;i++){

& for (j=0;j<=2;j++){

A[i][j]=A[i][j]+AT[i][j];

}

& }

//printing:

for (i=0;i<=2;i++){

& for (j=0;j<=2;j++){

cout<<A[i][j]<<"& quot;;

}

& cout<<"\r\n";

& }

getch();

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment