-
Notifications
You must be signed in to change notification settings - Fork 0
/
06-e06.c
63 lines (53 loc) · 1.23 KB
/
06-e06.c
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// displaying number with english words
#include <stdio.h>
int main(void) {
int input, revInput, numDigit, digit;
printf("number: ");
scanf("%i", &input);
do {
revInput *= 10;
revInput = revInput + input % 10;
input /= 10;
numDigit++;
} while (input);
do {
digit = revInput % 10;
revInput /= 10;
numDigit--;
switch (digit)
{
case 0:
printf("zero ");
break;
case 1:
printf("one ");
break;
case 2:
printf("two ");
break;
case 3:
printf("three ");
break;
case 4:
printf("four ");
break;
case 5:
printf("five ");
break;
case 6:
printf("six ");
break;
case 7:
printf("seven ");
break;
case 8:
printf("eight ");
break;
case 9:
printf("nine ");
break;
}
} while (numDigit);
printf("\n");
return 0;
}