Paste
Pasted as C++ by registered user xujiayu ( 4 years ago )
#include <stdio.h>
#include <conio.h>
#include <math.h>
//bai doc so
void nhapdulieu(int &n)
{
printf("\nNhap so : ");
scanf("%d",&n);
}
int tinhsoluongchuso ( int n)
{
int soluongchuso = 0;
int temp = 0;
while (n != 0)
{
int temp = n/10 ;
temp++;
temp = soluongchuso;
}
return soluongchuso;
}
/*void daoso(int &n)
{4
int soluongchuso;
int temp;
while (temp = 0)
{
temp /= 10;
}
temp = soluongchuso;
int tong = 0;
while (n != 0)
{
tong += n % 10 * pow ((double)10,soluongchuso--);
n/=10;
}
n = tong;
}
void docchuso (int sochuso)
{
if(sochuso == 1)
{
printf(" MOT ");
}
else if (sochuso == 2)
{
printf(" Hai ");
}
else if (sochuso == 3)
{
printf(" Ba ");
}
else if (sochuso == 4)
{
printf(" Bon ");
}
else if (sochuso == 5)
{
printf(" Nam ");
}
else if (sochuso == 6)
{
printf(" Sau ");
}
else if (sochuso == 7)
{
printf(" Bay ");
}
else if (sochuso == 8)
{
printf(" Tam ");
}
else if (sochuso == 9)
{
printf(" Chin ");
}
else if (sochuso == 10)
{
printf("Muoi");
}
else if (sochuso == 20)
{
printf("hai Muoi");
}
else if (sochuso == 30)
{
printf("ba Muoi");
}
else if (sochuso == 40)
{
printf("bon Muoi");
}
else if (sochuso == 50)
{
printf("Nam Muoi");
}
else if (sochuso == 60)
{
printf("Sau Muoi");
}
else if (sochuso == 70)
{
printf("Bay Muoi");
}
else if (sochuso == 80)
{
printf("Tam Muoi");
}
else if (sochuso == 90)
{
printf("Chin Muoi");
}
else if (sochuso == 100)
{
printf("Mot tram");
}
}
void docphuam (int sochusoconlai)
{
if(sochusoconlai == 1)
{
printf(" Muoi ");
}
else if(sochusoconlai == 2)
{
printf("Tram");
}
else if(sochusoconlai == 3)
{
printf("Nghin");
}
else if(sochusoconlai == 4)
{
printf("Muoi ");
}
else if(sochusoconlai == 5)
{
printf("Tram ");
}
else if(sochusoconlai == 6)
{
printf("Trieu");
}
else if(sochusoconlai == 7)
{
printf("Muoi Trieu");
}
else if(sochusoconlai == 8)
{
printf("Tram Trieu");
}
else if(sochusoconlai == 9)
{
printf("ty");
}
}
/*
1234
b1 dao thanh 4321
b2 %10 lay so cuoi roi doc len
b3 n chia 10 de loai bo so da doc
b4 la sau khi loai bo dem coi con bao nhieu chu so roi set cach doc phu am (tram , trieu, nghin)
*/
/*void docso (int n)
{
daoso(n);
while (n != 0)
{
docchuso(n %10);
n /= 10;
docphuam(log10((double)n)+1);
}
if
}*/
int main()
{
int a;
int soluongso;
nhapdulieu(a);
soluongso = tinhsoluongchuso(a);
printf("so luong chu so %d",soluongso);
getch();
return 0;
}
Revise this Paste
Children: 118702