Answers for "reverse array"

4

php reverse array

$array= array(1,2,3,4,5);
$reversedArray = array_reverse($array);

var_dump($y);
Posted by: Guest on February-20-2020
21

reversing an array in js

var arr=[1,2,5,6,2]
arr.reverse()
Posted by: Guest on June-26-2020
33

javascript reverse array

var arr = [34, 234, 567, 4];
print(arr);
var new_arr = arr.reverse();
print(new_arr);
Posted by: Guest on November-16-2019
0

reverse array

int[] intArray = { 1, 2, 3, 4, 5 };
ArrayUtils.reverse(intArray);
System.out.println(Arrays.toString(intArray));
//[5, 4, 3, 2, 1]
Posted by: Guest on June-25-2021
0

reverse array

#The original array
arr = [11, 22, 33, 44, 55]
print("Array is :",arr)
 
res = arr[::-1] #reversing using list slicing
print("Resultant new reversed array:",res)
Posted by: Guest on October-08-2021
0

reverse array

#include<iostream>
using namespace std;
int main()
{
    int arr[100], tot, i, j, temp;
    cout<<"Enter the Size for Array: ";
    cin>>tot;
    cout<<"Enter "<<tot<<" Array Elements: ";
    for(i=0; i<tot; i++)
        cin>>arr[i];
    cout<<"\nThe Original Array is:\n";
    for(i=0; i<tot; i++)
        cout<<arr[i]<<" ";
    j = tot-1;
    for(i=0; i<j; i++, j--)
    {
        temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }
    cout<<"\n\nThe Reverse of Given Array is:\n";
    for(i=0; i<tot; i++)
        cout<<arr[i]<<" ";
    cout<<endl;
    return 0;
}
Posted by: Guest on October-11-2021

Python Answers by Framework

Browse Popular Code Answers by Language