Skip to content

Instantly share code, notes, and snippets.

@syedjafer
Created April 28, 2021 10:38
Show Gist options
  • Save syedjafer/89958aa47625b3cefb139e284719d303 to your computer and use it in GitHub Desktop.
Save syedjafer/89958aa47625b3cefb139e284719d303 to your computer and use it in GitHub Desktop.
public class ReverseNum{
public static void main(String []args){
int arr[] = {1, 2, 3, 4, 5, 6};
int output_array[]=new int[6];
for (int itr=0, ctr=5; ctr >=0; ctr--, itr++){
output_array[itr] = arr[ctr];
}
for(int itr=0; itr<6; itr++){
System.out.println(output_array[itr]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment