Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure main;
- var
- a: array of Integer;
- i, n, evenSum, oddSum: Integer;
- begin
- write('Enter N: ');
- readln(n);
- setLength(a, n);
- for i := 0 to n - 1 do
- readln(a[i]);
- asm
- mov [oddSum], 0
- mov [evenSum], 0
- mov ebx, a
- mov ecx, [n]
- @main_cycle:
- test [ebx], 1
- mov eax, [ebx]
- jne @eva
- add [evenSum], eax
- jmp @exit
- @eva:
- add [oddSum], eax
- @exit:
- add ebx, 4
- loop @main_cycle
- end;
- writeln('Odd sum = ' + IntToStr(oddSum) + '; Even sum = ' + IntToStr(evenSum));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement