Array Addition using 2d array in C
#include<stdio.h>
void main()
{
int i,j;
int a[3][4],b[3][4],c[3][4];
for(i=0;i<3;i++){
for(j=0;j<4;j++){
printf("a[%d][%d]",i,j);
scanf("%d",&a[i][j]);
}
}
for(i=0;i<3;i++){
for(j=0;j<4;j++){
printf("%d ",a[i][j]);
}
printf("\n");
}
for(i=0;i<3;i++){
for(j=0;j<4;j++){
printf("b[%d][%d]",i,j);
scanf("%d",&b[i][j]);
}
}
for(i=0;i<3;i++){
for(j=0;j<4;j++){
printf("%d ",b[i][j]);
}
printf("\n");
}
printf("\n");
printf("sum of two array is :\n");
for(i=0;i<3;i++){
for(j=0;j<4;j++){
c[i][j]=a[i][j]+b[i][j];
}
}
for(i=0;i<3;i++){
for(j=0;j<4;j++){
printf("%d ",c[i][j]);
}
printf("\n");
}
}
Output:
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.