Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Two two-dimensional integer arrays with the same decimal places are defined in C language, and their addition and subtraction functions are realized by programming, and the results are saved in the ne
Two two-dimensional integer arrays with the same decimal places are defined in C language, and their addition and subtraction functions are realized by programming, and the results are saved in the ne
Two two-dimensional integer arrays with the same decimal places are defined in C language, and their addition and subtraction functions are realized by programming, and the results are saved in the new number. # contains "stdio.h"

int main()

{ int a[3][3],b[3][3],c[3][3],d[3][3];

//array a+ array b results into array C.

//array a- array b results into array d.

int i,j;

for(I = 0; I<3; I++) // Assign a value to the array a.

for(j = 0; j & lt3; j++)

scanf("%d ",& ampa[I][j]);

for(I = 0; I<3; I++) // Assign a value to the array b.

for(j = 0; j & lt3; j++)

scanf("%d ",& ampb[I][j]);

Printf ("output array a \ n");

for(I = 0; I<3; i++)

{ for(j = 0; j & lt3; j++)

printf("%4d ",a[I][j]);

printf(" \ n ");

}

Printf ("output array b \ n");

for(I = 0; I<3; i++)

{ for(j = 0; j & lt3; j++)

printf("%4d ",b[I][j]);

printf(" \ n ");

}

Printf ("the result of adding array A and array B: \ n");

for(I = 0; I<3; i++)

{ for(j = 0; j & lt3; j++)

{ c[I][j]= a[I][j]+b[I][j];

printf("%4d ",c[I][j]);

}

printf(" \ n ");

}

Printf ("Subtraction result of array A and array B: \ n");

for(I = 0; I<3; i++)

{ for(j = 0; j & lt3; j++)

{ c[I][j]= a[I][j]-b[I][j];

printf("%4d ",c[I][j]); }

printf(" \ n ");

}

}