# 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.
1
Expert's answer
2011-10-27T12:12:28-0400
#include <iostream.h>
#include <conio.h>

main(){
float A, AT;
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;
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 order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

#### Comments

No comments. Be the first!

### Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS