Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "pch.h"
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int number;
  8.     int result;
  9.  
  10.    
  11.     cin >> number;
  12.  
  13.     register int TMP;
  14.     register int RST;
  15.  
  16.     _asm {
  17.         MOV EAX, number
  18.         MOV EBX, 10
  19.         MOV ECX, 0
  20.         MOV EDX, 0
  21.  
  22.         _for:
  23.             CMP EAX, 0
  24.             JBE _afterFor
  25.  
  26.             DIV EBX
  27.             MOV RST, EDX
  28.  
  29.             MOV TMP, EAX
  30.             MOV EAX, ECX
  31.             MUL EBX
  32.             ADD EAX, RST
  33.             MOV ECX, EAX
  34.             MOV EAX, TMP
  35.             MOV EDX, 0
  36.             JMP _for
  37.  
  38.         _afterFor:
  39.             MOV EAX, number
  40.             CMP EAX, ECX
  41.             JE  _if
  42.             JMP _else
  43.  
  44.         _if:
  45.             MOV result, 1
  46.             JMP _final
  47.  
  48.         _else:
  49.             MOV result, 0
  50.             JMP _final
  51.  
  52.         _final:
  53.     }
  54.  
  55.     cout << result;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement