– Nhập vào 1 số có 3 chữ số
– Hiển thị cách đọc ra màn hình
– Dùng switch case hoặc if/else
Code
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| #include <stdio.h>const char *number_table[] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"};int main(){ int num; do { printf("\nnum = "); scanf("%d", &num); }while(num < 100 || num > 999); printf("%s %s %s", number_table[num/100], number_table[num/10%10], number_table[num%10]); return 0;} |
Kết quả:
Không có nhận xét nào:
Đăng nhận xét