Wednesday, 1 February 2012

Program To Print Left Digonal of Matrix In C++


#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
cout<<"\n Enter Rows=";
cin>>m;
cout<<"Enter COlumns=";
cin>>n;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<"ENter Number=";
}
}
cout<<"\n ===============First Matrix IS==========================\n";
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(i==j)
{
cout<<"\t"<<a[i][j];
}
else
{
cout<<"\t";
}
}
cout<<"\n";
}


getch();
}

No comments:

Post a Comment