Access Array Elements Using Pointer

Description:

The five elements are entered by the user and stored in the integer array data. Then, the data array is accessed using a for loop and each element in the array is printed onto the screen. Test Case 1 Input (stdin) 1 2 3 4 5 6 Expected Output 1 2 3 4 5 6 Test Case 2 Input (stdin) 1 3 5 7 9 11 Expected Output 1 3 5 7 9 11

Program :


#include <iostream>

using namespace std;

int main()

{

int i,a;

for(i=0;i<6;i++)

{

  cin>>a;

  cout<<a<<endl;

}

return 0;

}