File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 1111 *
1212 * @author Shanmuga Priya M
1313 */
14- public class reversearray {
15-
16- /**
17- * @param args the command line arguments
18- */
19- public static void main (String [] args ) {
14+ public static void main (String [] args ) {
2015 int a []=new int [10 ];
16+ int riv_a []=new int [10 ];
2117 int n ,i ;
2218 Scanner obj = new Scanner (System .in );
23- System .out .println ("enter sizr of array" );
19+ System .out .println ("enter size of array : " );
2420 n =obj .nextInt ();
25- System .out .println ("enter elements of array" );
21+ System .out .println ("enter elements of array : " );
2622 for (i =0 ;i <n ;i ++){
2723 a [i ]=obj .nextInt ();
2824 }
29- for (i =n -1 ;i >=0 ;i --){
30- System .out .println (a [i ]);
25+ for (i =0 ;i <n ;i ++){
26+ riv_a [i ]=a [n -1 -i ];
27+ }
28+ for (i =0 ;i <n ;i ++){
29+ System .out .println (riv_a [i ]);
3130 }
3231 }
3332
You can’t perform that action at this time.
0 commit comments