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

HOMEWORK 5 3b) Given two arrays ARR1 and ARR2 same size (100 entries, 4 bytes ea

ID: 3891677 • Letter: H

Question

HOMEWORK 5 3b) Given two arrays ARR1 and ARR2 same size (100 entries, 4 bytes each entry). Write program to copy elements of ARR1 into ARR2 in reverse order, for example, the first element of ARR1 will be the last element in ARR2 and so on. For example: (15 points) ARR1 13 20558 ARR2 55 20 13 -5 10 Hint: start the loop for ARR1 from tho first element of ARR1 (as usual) and for ARR2 start frm the last element (for example (ebx+ esi] is last element of ARR2 if esi has the right value, and in the loop, esi is decremented to go down to the previous element.) Hint this code: Adds 5 to every elements in the array Arr3 has 100 elements of 2 bytes each) Arrs TIMES 100 DD 0 mov ecx, 100 oop counter 100 times Sub si, siinitialize register si to zero mov ebx, Arr3 Adds: Add [ebx+ si], word 5 5 bytes add esi, 2advance si to the next element loop Add5 loop 100 based on register ecx

Explanation / Answer

Please find the ocde below for the problem mentioned:

#include<stdio.h>

void main()

{

int a[10],b[10],i,j;

clrscr();

printf(" Enter Elements : "); //enter elements in first array

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

{

scanf("%d",&a[i]);

}

for(i=0,j=9;i<10;i++,j--) //copy the element from array a[] to b[] in reverse order

{

b[i]=a[j];

}

printf(" Array after Copying in Reverse Order : ");

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

{

printf("%d ",b[i]);

}

getch();

}