Advertisement
Guest User

Untitled

a guest
Sep 14th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. package arraypractice3;
  2.  
  3. public class ArrayPractice3 {
  4.     public static void main(String[] args) {
  5.         int[] valA   = { 13, -22,  82,  17};
  6.         System.out.println("Original array:");
  7.         for (int i = 0; i < valA.length; i++)
  8.         {
  9.             System.out.print(valA[i] + ",");
  10.         }
  11.         System.out.println(); // new line
  12.         System.out.println("Reversed array:");
  13.         for (int temp = valA.length - 1; temp >= 0; temp--)
  14.         {
  15.             System.out.print(valA[temp] + ",");
  16.         }
  17.         System.out.println(); // new line
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement