Friday, 30 January 2015

Addition of Two dimensional Array in C++

Structure of the Problem Requirements 

The Program is related to Arrays where we learn how to add two,2 dimensional array in C++ program. The two dimensional array is one which vary from both sides. The one side indicate the rows and the second side is columns . 

Source Code

#include<iostream>
using namespace std;
int main ()
{
cout<<"\t \t \t LEP Tutorials \n \n \n ";
int nums1 [3][3],nums2[3][3],a,b;
cout<<"\t Matrix 1 \n \n";
for(a=0;a<3;a++)
{
for(b=0;b<3;b++)
{
cout<<"Enter number :";
cin>>nums1[a][b];
}
}
cout<<"\t Matrix 2 \n";
for(a=0;a<3;a++)
{
for(b=0;b<3;b++)
{
cout<<"Enter number :";
cin>>nums2[a][b];
}
}
cout<<"\t Sum \n";
for(a=0;a<3;a++)
{
for(b=0;b<3;b++)
{
cout<<nums1[a][b]+nums2[a][b]<<" ";
}
cout<<endl;
}
}

Output of the Progrm

Addition of Two dimensional Array in C++

Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment