#include<stdio.h>
int main()
{
int m,n,o,r,c;
printf("Enter the number of rows of arrys:");
scanf("%d",&r);
printf("Enter the number of colums of arrys:");
scanf("%d",&c);
int a[r][c];
int b[r][c];
printf("\nEnter values of first 2d arrays:\n");
for(m=0;m<r;m++)
{
for(n=0;n<c;n++)
{
printf("Enter values of array element for %d row and %d coulm:",m,n);
scanf("%d",&a[m][n]);
}
}
printf("\nEnter values for 2nd arry element\n");
for(m=0;m<r;m++)
{
for(n=0;n<c;n++)
{
printf("Enter values of array element for %d row and %d coulm:",m,n);
scanf("%d",&b[m][n]);
}
}
printf("\n");
printf("First aaray elements are\n");
for(m=0;m<r;m++)
{
for(n=0;n<c;n++)
{
printf("%3d",a[m][n]);
}
printf("\n");
}
printf("Second aaray elements are\n");
for(m=0;m<r;m++)
{
for(m=0;m<c;m++)
{
printf("%3d",b[m][n]);
}
printf("\n");
}
printf("\n\n\n");
printf("sum of arry element\n");
for(m=0;m<r;m++)
{
for(n=0;n<c;n++)
{
printf("%3d",a[m][n]+b[m][n]);
}
printf("\n");
}
getch();
return 0;
}
int main()
{
int m,n,o,r,c;
printf("Enter the number of rows of arrys:");
scanf("%d",&r);
printf("Enter the number of colums of arrys:");
scanf("%d",&c);
int a[r][c];
int b[r][c];
printf("\nEnter values of first 2d arrays:\n");
for(m=0;m<r;m++)
{
for(n=0;n<c;n++)
{
printf("Enter values of array element for %d row and %d coulm:",m,n);
scanf("%d",&a[m][n]);
}
}
printf("\nEnter values for 2nd arry element\n");
for(m=0;m<r;m++)
{
for(n=0;n<c;n++)
{
printf("Enter values of array element for %d row and %d coulm:",m,n);
scanf("%d",&b[m][n]);
}
}
printf("\n");
printf("First aaray elements are\n");
for(m=0;m<r;m++)
{
for(n=0;n<c;n++)
{
printf("%3d",a[m][n]);
}
printf("\n");
}
printf("Second aaray elements are\n");
for(m=0;m<r;m++)
{
for(m=0;m<c;m++)
{
printf("%3d",b[m][n]);
}
printf("\n");
}
printf("\n\n\n");
printf("sum of arry element\n");
for(m=0;m<r;m++)
{
for(n=0;n<c;n++)
{
printf("%3d",a[m][n]+b[m][n]);
}
printf("\n");
}
getch();
return 0;
}
Comments
Post a Comment