#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a[100],b[100],c[100],i,n;
printf("\nhow many elements in the array:\n");
scanf("%d",&n);
printf("\nenter the elements in the first matrix:\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("\nEnter the elements in the second matrix:\n");
for(i=0;i<n;i++)
{
scanf("%d",&b[i]);
}
printf("\nfirst matrix is\n");
for(i=0;i<n;i++)
{
printf("\t%d",a[i]);
}
printf("\nsecond matrix is\n");
for(i=0;i<n;i++)
{
printf("\t%d",b[i]);
}
for(i=0;i<n;i++)
c[i]=a[i]+b[i];
printf("\nSum of both row matrix is\n");
for(i=0;i<n;i++)
{
printf("\t%d",c[i]);
}
getch();
}
#include<conio.h>
void main()
{
clrscr();
int a[100],b[100],c[100],i,n;
printf("\nhow many elements in the array:\n");
scanf("%d",&n);
printf("\nenter the elements in the first matrix:\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("\nEnter the elements in the second matrix:\n");
for(i=0;i<n;i++)
{
scanf("%d",&b[i]);
}
printf("\nfirst matrix is\n");
for(i=0;i<n;i++)
{
printf("\t%d",a[i]);
}
printf("\nsecond matrix is\n");
for(i=0;i<n;i++)
{
printf("\t%d",b[i]);
}
for(i=0;i<n;i++)
c[i]=a[i]+b[i];
printf("\nSum of both row matrix is\n");
for(i=0;i<n;i++)
{
printf("\t%d",c[i]);
}
getch();
}
No comments:
Post a Comment