Take Inputs from User and Store Them in an Array


Example heading with h2 size

Example heading with h3 size

 

Following is sample java code.

int i = 10;
if(i>0){
    System.out.println('positive');
}
```#include <iostream>
using namespace std;

int main() {

  int numbers[5];

  cout << "Enter 5 numbers: " << endl;

  //  store input from user to array
  for (int i = 0; i < 5; ++i) {
    cin >> numbers[i];
  }

  cout << "The numbers are: ";

  //  print array elements
  for (int n = 0; n < 5; ++n) {
    cout << numbers[n] << "  ";
  }

  return 0;
}
[array02.cpp](https://static.onecompiler.com/images/posts/3yr32vphf/array02.cpp)