Monday, May 24, 2010

Write a C++(or JAVA) program for entering values in a 2-dimensional array as follows?

1--%26gt;2--%26gt;3


8--%26gt;9 4


7%26lt;--6%26lt;--5

Write a C++(or JAVA) program for entering values in a 2-dimensional array as follows?
int main() {


int m[4][4];





printf("\n Enter the values of the first row : ");


for(int j=1;j%26lt;=3;j++)


scanf("%d ",%26amp;m[1][j]) ;





printf("\n m[2][1]=");


scanf("%d",%26amp;m[2][1]);





printf("\n m[2][2]=");


scanf("%d",%26amp;m[2][2]);





printf("\n m[2][3]=");


scanf("%d",%26amp;m[2][3]);





printf("\n Enter the values of the third row : ");





for(int j=3; j%26gt;0; j--)


scanf("%d ",%26amp;m[3][j]) ;


return 0;


}











P.S: rewrite it using the first zero index

buy flowers

No comments:

Post a Comment