title: In my console game with C, '90' is printed instead of '9'
body: <p>I was making a console game with C on Visual Studio 2019. I made a code that print a variable.</p>
  
  <p>It works only when value is greater than 10 .</p>
  
  <p>If value of variable is less than 10 it <strong>prints 10 instead of 1, 2 instead of 20 ... 9 instead of 90</strong>.</p>
  
  <p>I have no idea how to solve this problem.</p>
  
  <p>Here is my code</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;windows.h&gt;
  
  int a =20;
  
  void gotoxy(int x, int y) { //cursor goes to x, y
      COORD CursorPosition = { x,y };
      SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), CursorPosition);
  }
  
  void HideCursor() {
      HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
      CONSOLE_CURSOR_INFO info;
      info.dwSize = 100;
      info.bVisible = FALSE;
      SetConsoleCursorInfo(consoleHandle, &amp;info);
  }
  
  void count() {
      char c = _getch();
      switch (c) {
      case 'p': a++; break;
      case 'o': a--; break;
      }
  }
  
  int main() {
      system("mode con cols=10 lines=10");
      system("cls");
      HideCursor();
      while (1) {
          gotoxy(5, 5);
          count();
          printf("%d", a);
      }
  }
  
  </code></pre>