Skip to content

Instantly share code, notes, and snippets.

@alesya-h
Last active August 29, 2015 14:13
Show Gist options
  • Save alesya-h/a19fa94d6825934ce128 to your computer and use it in GitHub Desktop.
Save alesya-h/a19fa94d6825934ce128 to your computer and use it in GitHub Desktop.
#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;
}
#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