What's New-Given Below
technicalsymposium
technicalsymposium
technicalsymposium

C/C++ Lab Program(s)/Materials

C Program For Matrix addition.

#include<stdio.h>
#include<conio.h>
void main()
{
int r,c,a[10][10],i,j,m,n,b[10][10],z[10][10];
clrscr();
printf("Enter r and c value:");
scanf("%d%d",&r,&c);
for(i=1;i<=r;i++)
{
for(j=1;j<=c;j++)
{
printf("a[%d][%d]=",i,j);
scanf("%d",&a[i][j]);
}
}
for(m=1;m<=r;m++)
{
for(n=1;n<=c;n++)
{
printf("b[%d][%d]=",m,n);
scanf("%d",&b[m][n]);
}
}
// z[i][j]=0;
for(i=1;i<=r;i++)
{
for(j=1;j<=c;j++)
{
z[i][j]=(a[i][j]+b[i][j]);
}
}
for(i=1;i<=r;i++)
{
for(j=1;j<=c;j++)
{
printf("%d\t",z[i][j]);
}
printf("\n");
}
getch();
}

More Lab Programs with Answers -Given Below-Click and Get Freely

Hosting by Yahoo!

About-Us    Contact-Us    Site-map

©copyright 2009 All rights are reserved to technicalsymposium.com