Addition of Two dimensional Array in C++

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 on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment