Thursday, 28 July 2011

Program to enter a 5*5 matrix and display it


class matrix
{
Public static void main (String arg [])
{
int two [] [] = new int [5] [5];
{
int i,j,k =0;
for (i= 0; i<5 ; i++) {
for (j=0 ; j<5; j++)
{
Two [i] [j] = k;
k++;
} }
for (i=0; k=5 ;i++)
{
for (j=0; j<5 ; j++)
{
System.out.print( two [i] [i] + “  “ );
}
System.out.println( );
}
}
}

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More