Pages

Subscribe:

Blogger templates

Monday, October 31, 2011

Display a Matrix

1. Program to print following :


-------------------------------------------------------------------------------------------------------------

//Program to Print a Matrix( 3-3)
//source ncertcpp.blogspot.com
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
int i,j,a[3][3];
cout<<"\nPlease enter elements of Matrix:\n";
for(i=0;i<3;i++)
 {
 for(j=0;j<3;j++)
  {
  cin>>a[i][j];
  }
 }
cout<<"\nMatrix you entered is as  follows\n";
for(i=0;i<3;i++)
 {
 for(j=0;j<3;j++)
  {
  cout<<a[i][j];
  cout<<"\t";
  }
 cout<<"\n";
 }
getch();
}
-------------------------------------------------------------------------------------------------------------




Please comment if you have any Problem.....
or if program doesnt works.....