Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <conio.h>
- int doc(int s);
- int main()
- {
- long n;
- int s, k=0, b, c, x, t;
- printf("\nNhap so n: "); scanf("%ld", &n);
- b=n;
- while (b>0)
- {
- b/=10;
- k++;
- }
- do
- {
- t = pow(10, k-1);
- x = n/t;
- doc(x);
- n= n%t;
- k=k-1;
- }
- while (n>0);
- return 0;
- }
- int doc(int s)
- {
- switch(s)
- {
- case 0: printf("khong "); break;
- case 1: printf("mot "); break;
- case 2: printf("hai "); break;
- case 3: printf("ba "); break;
- case 4: printf("bon "); break;
- case 5: printf("nam "); break;
- case 6: printf("sau "); break;
- case 7: printf("bay "); break;
- case 8: printf("tam "); break;
- case 9: printf("chin "); break;
- default: printf("sai "); break;
- }
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement