Sunday, March 17, 2013

2-D Array Displaying

#include<iostream>
using namespace std;
int main()
{
    int a[3][3],i,j;
    for(i=0;i<3;++i)             /*taking input for the array*/
    {
        for(j=0;j<3;++j)
        {
            cin>>a[i][j];
        }
    }
    cout<<"\n\n\n";
    for(i=0;i<3;++i)            /*displaying the array*/
    {
        for(j=0;j<3;++j)
        {
            cout<<a[i][j]<<" ";
        }
        cout<<endl;
    }
    return 0;
}

0 comments:

Post a Comment