Task 1 Create an Array that holds a 20 random integers betwe
Task 1: Create an Array that holds a 20 random integers between 1-50. Create an iterator that will return the memory address and value for each integer present in the Array.
Solution
Ans.
#include <iostream>
using namespace std;
int main() {
// your code goes here
int a[20];
int p;
for (int i = 0; i < 20; i++)
{
int r = rand() % 50 + 1;
a[i] = r;
p = *a;
cout<<a[i]<<endl;
cout<<p<<endl;
}
return 0;
}
