File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ * To change this license header, choose License Headers in Project Properties.
3+ * To change this template file, choose Tools | Templates
4+ * and open the template in the editor.
5+ */
6+ package reverse .of .array ;
7+
8+ /**
9+ *
10+ * @author shubhendu
11+ */
12+ import java .util .Scanner ;
13+ public class ReverseOfArray {
14+
15+ /**
16+ * @param args the command line arguments
17+ */
18+ public static void main (String [] args ) {
19+ // TODO code application logic here
20+ Scanner in =new Scanner (System .in );
21+ int n =0 ,m =0 ,i ,b ;
22+ System .out .println ("enter the row size of the array" );
23+ System .out .println ("enter the column size of the array" );
24+
25+ n =in .nextInt ();
26+ m =in .nextInt ();
27+ int arr [][]=new int [2 ][2 ];
28+
29+ System .out .println ("enter elements" );
30+ for (i =0 ;i <2 ;i ++)
31+ {
32+ for (b =0 ;b <2 ;b ++)
33+ {
34+ arr [i ][b ]=in .nextInt ();
35+ }
36+ }
37+ System .out .println ("entered elements are:" );
38+ for (i =0 ;i <2 ;i ++)
39+ {
40+ for (b =0 ;b <2 ;b ++)
41+ {
42+ System .out .print (arr [i ][b ]+ " " );
43+ }
44+ System .out .println ();
45+ }
46+ System .out .println ("reverse of matrix is:" );
47+ for (i =2 -1 ;i >=0 ;i --)
48+ {
49+ for (b =2 -1 ;b >=0 ;b --)
50+ {
51+ System .out .print (arr [i ][b ]+ " " );
52+ }
53+ System .out .println ();
54+ }
55+
56+
57+
58+
59+
60+
61+ }
62+ }
63+
64+
You can’t perform that action at this time.
0 commit comments