-
-
Save alesya-h/a19fa94d6825934ce128 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<windows.h> | |
DWORD summ(DWORD a) | |
{ | |
__asm | |
{ | |
push ebx | |
push edx | |
push esi | |
xor esi, esi | |
mov eax, a | |
mov bx, 10 | |
a_div: | |
xor edx, edx | |
div bx | |
add esi, edx | |
cmp ax, 0 | |
jne a_div | |
mov eax, esi | |
pop esi | |
pop edx | |
pop ebx | |
} | |
} | |
int main() | |
{ | |
DWORD i, j; | |
printf("Specify number which you want to change: "); | |
scanf_s("%d", &i); | |
j = summ(i); | |
printf("%d.\n", i); | |
system("pause"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<windows.h> | |
DWORD summ(DWORD a) | |
{ | |
DWORD result; | |
__asm | |
{ | |
push eax | |
push ebx | |
push edx | |
push esi | |
xor esi, esi | |
mov eax, a | |
mov bx, 10 | |
a_div: | |
xor edx, edx | |
div bx | |
add esi, edx | |
cmp ax, 0 | |
jne a_div | |
mov result, esi | |
pop esi | |
pop edx | |
pop ebx | |
pop eax | |
} | |
return result; | |
} | |
int main() | |
{ | |
DWORD i, j; | |
printf("Specify number which you want to change: "); | |
scanf_s("%d", &i); | |
j = summ(i); | |
printf("%d.\n", i); | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment