Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. In main(), define an integerarray with 20 elements, assign random numbers usi

ID: 3614721 • Letter: 1

Question

1. In main(), define an integerarray with 20 elements, assign random numbers using rand(); findthe largest one and smallest one, and output the results (print allnumbers first and then print the largest one and smallestone).

Note: to avoidgenerating same random number sequence, insertsrand(time(NULL));as the first statement in main().

2. In main(), define a two dimensional integerarray N[5][5] which has 5 rows and 5 columns, a total of 25 integerelements. Initialize the array by generating random numbersbetween 60and 100using function rand() andassigning them to the array integers. Then define twoarrays: S[5] andA[5]; and useloops to calculate the sum and average of the numbers in each rowof N[5][5](i.e. numbers that have the same row index), assign the resultsto S[5]and A[5],respectively. Output S[5] and A[5] results.

Explanation / Answer

please rate - thanks #include #include using namespace std; int main() {int a[20],i,large,small; srand(time(NULL)); a[0]=rand(); large=a[0]; small=a[0]; for(i=1;ilarge)        large=a[i];    else if(a[i]