Consider the following array with the contents given (you have to declare it in your program):

5 9 11 16 20 25 19 7 30 13

Write an assembly program to convert each of the even numbers in the array to its next higher odd numbers and each of the odd numbers in the array to its immediate lower even numbers. then add all modified numbers in the array and sotre result in a memory location 'RESULT'. consider each of the element is of WORD size.
Write the code using index addressing.

Here's an assembly program using index addressing to solve the given problem:

```assembly
.DATA
array WORD 5, 9, 11, 16, 20, 25, 19, 7, 30, 13
RESULT WORD ?

.CODE
MAIN PROC

MOV AX, @DATA
MOV DS, AX ; Initialize data segment

LEA SI, array ; Load effective address of array into SI
MOV CX, 10 ; Set the loop counter to the number of elements in the array

LOOP_START:
MOV AX, [SI] ; Load the current element into AX

TEST AX, 1 ; Check if the current element is odd or even
JZ EVEN ; If it's even, jump to the EVEN label

DEC AX ; Decrement the odd number by 1

JMP CONTINUE

EVEN:
ADD AX, 2 ; Add 2 to the even number to get the next higher odd number

CONTINUE:
ADD [SI], AX ; Add the modified number back into the array

ADD SI, 2 ; Move to the next element in the array

LOOP LOOP_START ; Loop until all elements have been processed

MOV SI, OFFSET array ; Reset SI to the start of the array
MOV CX, 10 ; Set the loop counter to the number of elements in the array

MOV AX, 0 ; Initialize AX with 0

SUM_LOOP:
ADD AX, [SI] ; Add each element in the array to AX

ADD SI, 2 ; Move to the next element in the array

LOOP SUM_LOOP ; Loop until all elements have been added

MOV RESULT, AX ; Store the result in memory location 'RESULT'

MOV AX, 4C00h ; Set the exit code to 0
INT 21h

MAIN ENDP
END MAIN
```

This program uses the `array` variable to store the given array, and the `RESULT` variable to store the final result. It uses the `SI` register with index addressing to access each element of the array.

In the first loop, the program checks if each element is odd or even using the `TEST` instruction. If it's odd, it decrements the number by 1 to obtain the immediate lower even number. If it's even, it adds 2 to the number to obtain the next higher odd number. The modified number is then added back into the array.

After modifying all the numbers in the array, the program initializes `AX` with 0 and loops through the array again to add all the modified numbers together. The final sum is stored in the `RESULT` variable.

Finally, the program sets the exit code to 0 and terminates.

Sure! Here is an example assembly program that uses index addressing to convert the numbers in the array and store the sum in the 'RESULT' memory location:

```assembly
DATA SEGMENT
ARRAY DW 5, 9, 11, 16, 20, 25, 19, 7, 30, 13
RESULT DW ?
DATA ENDS

CODE SEGMENT
ASSUME DS:DATA, CS:CODE

START:
MOV AX, DATA
MOV DS, AX

XOR BX, BX ; Initialize the array index to zero

LOOP_START:
MOV AX, [ARRAY+BX*2] ; Load value of array element at index BX into AX

CMP AX, 0 ; Check if number is even
JNE ODD ; Jump to the ODD label if number is odd

EVEN:
ADD AX, 1 ; Increment even number to the next odd number

JMP CONTINUE

ODD:
SUB AX, 1 ; Decrement odd number to the immediate lower even number

CONTINUE:
ADD WORD PTR [RESULT], AX ; Add the modified number to the result

ADD BX, 1 ; Increment the array index
CMP BX, 10 ; Check if all array elements have been processed
JNE LOOP_START ; Jump to LOOP_START if there are more elements to process

EXIT:
MOV AX, 4C00H ; Exit the program
INT 21H

CODE ENDS
END START
```

In this program, `ARRAY` is declared as an array of WORD (2-byte) elements, and `RESULT` is declared as a WORD variable to store the sum of the modified numbers.

The program uses index addressing (via the `BX` register) to access elements of the array. It starts by initializing the array index to zero (`XOR BX, BX`), and then enters a loop to process each element of the array. Inside the loop, the program checks if the current number is even or odd using the `CMP` instruction. Depending on the result, it either increments the even number to the next odd number or decrements the odd number to the immediate lower even number. The modified number is then added to the `RESULT` variable using the `ADD` instruction.

After all the elements have been processed, the program exits using the `INT 21H` instruction.