Bài tập Pascal Free Pascal 01 đến 16 Có bài giải (từ đơn giản đến nâng cao) BY Nguyễn Anh Việt
https://app.box.com/s/mtg0fzik6bet3tes96tu4bmt8wsxaahw
https://app.box.com/s/mtg0fzik6bet3tes96tu4bmt8wsxaahw
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Bài tập Pascal – Từ cơ bản đến nâng cao
WriteLn('Hay nhap he can doi (tu 2 den 16)');
ReadLn(m);
k := n;
While k>0 do Begin
If k mod m = 0 then Ch:='0'+Ch
Else If k mod m = 1 then Ch:='1'+Ch
Else If k mod m = 2 then Ch:='2'+Ch
Else If k mod m = 3 then Ch:='3'+Ch
Else If k mod m = 4 then Ch:='4'+Ch
Else If k mod m = 5 then Ch:='5'+Ch
Else If k mod m = 6 then Ch:='6'+Ch
Else If k mod m = 7 then Ch:='7'+Ch
Else If k mod m = 8 then Ch:='8'+Ch
Else If k mod m = 9 then Ch:='9'+Ch
Else If k mod m = 10 then Ch:='A'+Ch
Else If k mod m = 11 then Ch:='B'+Ch
Else If k mod m = 12 then Ch:='C'+Ch
Else If k mod m = 13 then Ch:='D'+Ch
Else If k mod m = 14 then Ch:='E'+Ch
Else Ch:='F' + Ch;
k := k div m;
End;
WriteLn('So ', n, ' trong he 10 doi sang he ‘, m, ‘ la ', Ch);
ReadLn;
End.
Biên soạn: Th.s Nguyễn Anh Việt Trang 38