![]() |
Array Coding For Matrices In C Programming |
Thank You Vinay Kumar For Writing The Source Code About Array Coding For Matrices In C Programming.
How To Copy & Paste This SourceCode Into Your C Programming Code Editor :
1. Copy Source Code Below
2. Open A New Notepad/Text Document
3. Paste The Source Code
4. Then Save The Source Code Document As Example.C(You Will Save The Document With The Extension '.C')
5. In The Location C:/ExampleCodeEditor(TurboC3)/Disk/TurboC3/BIN/ExampleCodeName(Example.C)
6. Now Open The C Programming Code Editor And Click Open/F3 Then Type What Name Giving To That Source Code In The Past Time Like Example.C
7. Then Select Open, It Will Be Opened Successfully
8. Now Compile The Source Code & Check Any Errors In That Source Code
9. Finally, No Errors In That Code & Successfully Run The Code
Coding For Matrices :
Source Code Here :
Sample Input
#include<stdio.h>
int main()
{
int a[20][20],b[20][2],c[20][20],i,j,c1,r;
printf("size of row\n");
scanf("%d",&r);
printf("size of column\n");
scanf("%d",&c1);
printf("the arrays are\n");
for(i=0;i<r;i++)
{
for(j=0;j<c1;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("matrix of A\n");
for(i=0;i<r;i++)
{
for(j=0;j<c1;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}
for(i=0;i<r;i++)
{
for(j=0;j<c1;j++)
{
scanf("%d",&b[i][j]);
}
}
printf("matrix of B\n");
for(i=0;i<r;i++)
{
for(j=0;j<c1;j++)
{
printf("%d\t",b[i][j]);
}
printf("\n");
}
for(i=0;i<r;i++)
{
for(j=0;j<c1;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
printf("\n");
}
printf("the matrix of c\n");
for(i=0;i<r;i++)
{
for(j=0;j<c1;j++)
{
printf("%d\t",c[i][j]);
}
printf("\n");
}
0 Comments