Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int a;
- int even=0, odd=0;
- cout<<"Type a: ";
- cin>>a;
- __asm{
- mov ebx,a
- beg_ord:
- cmp ebx,0
- jle end_ord
- mov eax,ebx
- mov ecx,2
- xor edx, edx
- cdq
- idiv ecx
- //if even/odd
- cmp edx,0
- je eql_
- jmp neql_
- neql_:
- mov edx,odd
- add edx,1
- mov odd,edx
- jmp next_
- eql_:
- mov edx,even
- add edx,1
- mov even,edx
- jmp next_
- next_:
- mov eax,ebx
- mov ecx,10
- xor edx, edx
- cdq
- idiv ecx
- mov ebx,eax
- jmp beg_ord
- end_ord:
- }
- cout<<"Number: "<<a<<" even: "<<even<<" odd: "<<odd<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement