Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   loop sum, loop mult, divide (http://www.go4expert.com/forums/loop-sum-loop-mult-divide-t19533/)

 dakobbie03 23Sep2009 21:18

loop sum, loop mult, divide

inside my block _asm i am creating a couple loops and then taking the mult loop and dividing it by the sum. i am new to assembly. the numbers i'm adding up are 1-100 = 5050. The numbers that are multiplied are 1-10 = 3628800. Then multiply the value in Total by -1 and divide by the Sum. this is a start below....need some guidance.

PHP Code:

``` #include <iostream>using namespace std;void main ()    {    long Sum;    long Total;    long Result;    long Remainder;    _asm        {         mov eax, 0         mov ecx, 100l1:         add eax, ecx         mov Sum, eax         inc eax         loop l1         xor eax, eax         mov ecx, 10l2:         imul eax         mov Total, edx         inc eax         loop l2             mov eax, Total         mov ebx, Sum         idiv ebx         mov Result, eax         mov Remainder, edx }    cout << "Sum is        " << Sum << endl;    cout << "Total is      " << Total << endl;     cout << "Result is     " << Result << endl;    cout << "Remainder is  " << Remainder << endl;}  ```

 All times are GMT +5.5. The time now is 18:04.