Program B1; Var n:real; htr,hng,hti,hty,code:integer; a:array[1 9] of string[5]; chu:string; so,tram,nghin,trieu,ty:string[20]; Function Doi(nn:integer):string; Var sochu:string; htram,hchuc,donvi:0 9; Begin htram:=(nn div 100); hchuc:=(nn mod 100) div 10; donvi:=(nn mod 10); sochu:=''; if htram<>0 then sochu:=sochu+a[htram]+' tram' else sochu:=sochu+' khong tram'; if hchuc<>0 then sochu:=sochu+a[hchuc]+' muoi' else sochu:=sochu+' linh'; if donvi<>0 then sochu:=sochu+a[donvi] else if donvi=5 then sochu:=sochu+' lam'; Doi:=sochu; End; BEGIN a[1]:=' mot'; a[2]:=' hai'; a[3]:=' ba'; a[4]:=' bon'; a[5]:=' nam'; a[6]:=' sau'; a[7]:=' bay'; a[8]:=' tam'; a[9]:=' chin'; repeat writeln('Nhap so:'); readln(n); until (n>=0) and (n<=1000); if n=0 then chu:='khong' else begin chu:=''; str(n:12:0,so); tram:=copy(so,10,3); nghin:=copy(so,7,3); trieu:=copy(so,4,3); ty:=copy(so,1,3); val(tram,htr,code); val(nghin,hng,code); val(trieu,hti,code); val(ty,hty,code); if hty<>0 then chu:=chu+doi(hty)+' ty'; if hti<>0 then chu:=chu+doi(hti)+' trieu'; if hng<>0 then chu:=chu+doi(hng)+' nghin'; if htr<>0 then chu:=chu+doi(htr)+' trieu'; writeln(chu); end; readln; END. . htram:=(nn div 100); hchuc:=(nn mod 100) div 10; donvi:=(nn mod 10); sochu:=''; if htram<>0 then sochu:=sochu+a[htram]+' tram' else sochu:=sochu+' khong tram'; . Program B1; Var n:real; htr,hng,hti,hty,code:integer; a:array[1 9] of string[5]; chu:string; so,tram,nghin,trieu,ty:string[20]; Function Doi(nn:integer):string; Var sochu:string; htram,hchuc,donvi:0. else begin chu:=''; str(n:12:0,so); tram:=copy(so,10,3); nghin:=copy(so,7,3); trieu:=copy(so,4,3); ty:=copy(so,1,3); val(tram,htr,code); val(nghin,hng,code); val(trieu,hti,code);