summaryrefslogtreecommitdiff
path: root/21_read_rec1/test.c
blob: 52fd4e46de691efae8d19cd8d76434aacb7ea15f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdlib.h>

void printDigits(int x) {
  if (x == 0) {
    printf("0");
  }
  else if (x < 0) {
    printf("-");
    printDigits(-x);
  }
  else {
    int a = x/10;
    int b = x %10;
    printf("a=%d, b=%d\n",a,b);
    if (a != 0) {
      printDigits(a);
    }
    printf("%d",b);
  }
}


int main(void) {
  printDigits(297);
  printf("\n");
  return EXIT_SUCCESS;
}