C++ Programs
Monday, 18 May 2015
Write a program in c++ which initialize a two dimensional array and print all the elements in matrix form.
Coding:-
#include<iostream.h>
void main()
{
int a[2][3]={1,2,3,4,5,6,7,8};
int i,j;
cout<<"the array is : \n";
for(i=0;i<=1;i++)
{
for(j=0;j<=2;j++)
cout<<" "<<a[i][j];
cout<<"\n";
}
}
Output:-
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment