I'm writing a program as a beginner in assembly my program is about summing up all integers in array and then getting their average . I'm stuck with the average is that i need to divide the sum of numbers by my array size and i don't know according to assembly's syntax how to get to this any help please :) thank you

Recommended Answers

All 2 Replies

mov     esi,ak
        mov     ecx,0
        mov     cx,[qak]
        mov     eax,0;sum
msum:
        add     ax,word [esi]
        add     esi,2
        loop    msum

        mov     edx,0
        mov     ebx,0
        mov     bx,[qak]
        div     ebx
;EAX contains average now

Thank YOU skaa :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.