Tuesday, 24 February 2015

Two Dimensional Array in C++

#include<iostream.h>
#include<conio.h>
main()
{
int i=0,j=0,a[3][3],b[3][3],c[3][3];
clrscr();
cout<<"\n Enter First Two Dimentional Array values \n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];
}
}

cout<<"\n Enter Second Two Dimentional Array values \n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>b[i][j];
}
}

for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}


cout<<"\n First+Second Array\n";

for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<"\t"<<c[i][j];
}
cout<<"\n";
}
getch();
}

No comments:

Post a Comment