# Hacker Rank solution for Arrays Introduction In C++

Problem:- Arrays Introduction Hacker Rank Solution or Arrays Introduction hacker rank solution c++ orMulti Level Inheritance in java or Arrays Introduction solution or Arrays Introduction solution in C++ or Arrays Introduction hacker rank solution in Java or Arrays Introduction hacker rank solution c++ or Arrays Introduction hacker rank solution c++ or Arrays Introduction program in c or Arrays Introduction solution in C or Hacker Rank Solution For Arrays Introduction in C++ or Arrays Introduction in C++ or Hacker Rank solution for Arrays Introduction in C++.

Explanation:- We know that array is used to store similar datatype and an array used continues memory location in this problem we have to take an input from user and print reverse output by printing the last index first until an array first index.

Check- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard Domain.

Solution:-

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
int n;
cin >> n;
int array[n];

for(int i = 0; i < n; i++)
{
cin >> array[i];
}

for(int i = n - 1; i >= 0; i--)
{
cin >> array[i];
cout << array[i] << " ";
}
return 0;
}

Output:-

C++ Program To Merge Two Array In Third Array Unconditionally

1. for(int i = n - 1; i >= 0; i--){
// cin >> array[i];
cout << array[i] << " ";

I have marked the unnecesarry line. u dont need to read values again cause there isnt a second value entrance.

1. 2. nt n;
cin >> n;
int array[n];

Hi Execute this piece of code in VS 2013 or any version. Look for the error. Its wrong. Kindly correct it.

1. if you are facing error then change your code:=
int arr,n;
cin>>n;
some compiler doesnt support that time of declaration and initilization i advice change you compilor