10 Mar 2013

2-D Array

/*

 Program to print a 2-D array....
 
*/

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int b[5][5],i,a,j,k;
cout<<"Enter the no. of rows and columns :";
cin>>j>>k;
cout<<"Enter the elements:"<<endl;
for(i=0;i<j;i++)
 for(a=0;a<k;a++)
  {
   cin>>b[i][a];
  }
 for(i=0;i<j;i++)
  {

   cout<<endl;
   for(a=0;a<k;a++)
    {
     cout<<b[i][a]<<'\t';
    }
  }
getch();
}

Categories: , ,

0 comments:

Post a Comment

Copyright © UPgradeCODING | Powered by Blogger