diff --git a/ReverseArray.cpp b/ReverseArray.cpp new file mode 100644 index 0000000..128c71a --- /dev/null +++ b/ReverseArray.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; + +int main() { + //to reverse an array + int n; + cout<<"Enter the size of an array: "<>n; + //declaring array + int ar[n]; + cout<<"Enter an array: "<>ar[i]; + } + int i=0; + int j=n-1; + while(i<=j){ + int temp; + temp=ar[i]; + ar[i]=ar[j]; + ar[j]=temp; + i++; + j--; + } + cout<<"Reverse array is: "<