#include <iostream>
using namespace std;
int main() {
int marks[1000], i, j;
cout << "Enter the size of an array: ";
cin >> i;
for (j = 0; j <= i; j++) {
cout << "Enter " << i << " element of array: ";
cin >> marks[i];
i++;
}
for (j = 0; j <= i; j++) {
cout << "The " << i << " element of array is: " << endl;
i++;
}
return 0;
}
I declared an integer array initially along with i
and j
variables. Then I asked the user for the size of an array and then assigned it to i
variable. Then i
initialized a for loop and asked the user to input the element of an array and stored them in i
of array. I think I made some mistake in for loop so can you guys help me with that?