Sunday, December 14, 2008

Program 7:Array program

public class marray

{

public static void main(String[] args)

{

int i,j;

int b[]= {1, 2, 3, 4};

int a[][]={

{1, 2, 3, 4},

{2, 3, 4, 5},

{3, 4, 5, 6},

{4, 5, 6, 7},

};

System.out.println("Single Dy-Array");

System.out.println("_______________");

System.out.println();

for(i=0;i<4;i++)

{

System.out.print(b[i]);

System.out.print(" ");

}

System.out.println();

System.out.println();

System.out.println("Double Dy-Array");

System.out.println("_______________");

System.out.println();

for(i=0;i<4;i++)

{

System.out.println();

for(j=0;j<4;j++)

{

System.out.print(a[i][j]);

System.out.print(" ");

}

}

}

}

No comments: