Bài tập pascal chương 9
Chia sẻ bởi Lê Quang Phúc |
Ngày 06/11/2018 |
29
Chia sẻ tài liệu: Bài tập pascal chương 9 thuộc Tin học 9
Nội dung tài liệu:
BT1_ chuong9
Program Doi_thap_phan_ra_nhi_phan;
Var
He10,N,Y:Word;
He2,Tam:String;
Begin
Writeln(`DOI SO TU HE THAP PHAN SANG HE NHI PHAN`);
Writeln(` -----------------`);
Writeln;
Write(`-Nhap so nguyen he thap phan: `);
Readln(He10);
N:=He10;
He2:=` `;
Repeat
Y:=He10 Mod 2;
Str(Y, Tam);
He2:=Tam + He2;
He10:= He10 Div 2;
Until He10 = 0;
Writeln;
Writeln(`+So he 10 la : `,N);
Writeln(`+Doi sang he 2 la: `,He2);
Writeln;
Writeln(` Bam phim de ket thuc`);
Readln
End.
BT2 chuong 9
Program Doi_thap_phan_ra_bat_phan;
Var
He10,N,Y:Word;
He8,Tam:String;
Begin
Writeln(`DOI SO TU HE THAP PHAN SANG HE BAT PHAN`);
Writeln(` -----------------`);
Writeln;
Write(`-Nhap so nguyen he thap phan: `);
Readln(He10);
N:=He10;
He8:=` `;
Repeat
Y:=He10 Mod 8;
Str(Y, Tam);
He8:=Tam + He8;
He10:= He10 Div 8;
Until He10 = 0;
Writeln;
Writeln(`+So he 10 la : `,N);
Writeln(`+Doi sang he 8 la: `,He8);
Writeln;
Writeln(` Bam phim de ket thuc`);
Readln
End.
BT3 chuong9
Program Doi_thap_phan_ra_thap_luc;
Var
He10,N,Y:Word;
He16,Tam:String;
Begin
Writeln(`DOI SO TU HE THAP PHAN SANG HE THAP LUC PHAN`);
Writeln(` -----------------`);
Writeln;
Write(`-Nhap so nguyen he thap phan: `);
Readln(He10);
N:=He10;
He16:=` `;
Repeat
Y:=He10 Mod 16;
If Y < 10 Then
Str(Y, Tam)
Else
Tam:=Chr(Y+55);
He16:=Tam + He16;
He10:= He10 Div 16;
Until He10 = 0;
Writeln;
Writeln(`+So he 10 la : `,N);
Writeln(`+Doi sang he 16 la: `,He16);
Writeln;
Writeln(` Bam phim de ket thuc`);
Readln
End.
BT 4 chuong 9
Program Doi_thap_phan_ra_he_bat_ky;
Var
He10,N,Y,HeN:Word;
He,Tam:String;
Begin
Writeln(`DOI SO TU HE THAP PHAN SANG HE BAT KY`);
Writeln(` -----------------`);
Writeln;
Write(`-Nhap so nguyen he thap phan: `);
Readln(He10);
N:=He10;
Write(`-Doi sang he nao: `);
Readln(HeN);
He:=` `;
Repeat
Y:=He10 Mod HeN;
If Y < 10 Then
Str(Y, Tam)
Else
Tam:=Chr(Y+55);
He:=Tam + He;
He10:= He10 Div HeN;
Until He10 = 0;
Writeln;
Writeln(`+So he 10 la : `,N);
Writeln(`+Doi sang he: `,HeN:2,` la: `,He);
Writeln;
Writeln(` Bam phim de ket thuc`);
Readln
End.
BT 5 chuong 9
Program So_thu_Tu_ma_ASCII;
Var
St:String;
i:Byte;
Begin
Writeln(`SO THU TU MA ASCII CUA TUNG KY TU TRONG CHUOI`);
Writeln(` --------------------`);
Write(`-Nhap chuoi: `);
Readln(St);
Writeln;
For i:=1 To Length(St) Do
Write(` `,Ord(St[i]));
Writeln;
Writeln
Program Doi_thap_phan_ra_nhi_phan;
Var
He10,N,Y:Word;
He2,Tam:String;
Begin
Writeln(`DOI SO TU HE THAP PHAN SANG HE NHI PHAN`);
Writeln(` -----------------`);
Writeln;
Write(`-Nhap so nguyen he thap phan: `);
Readln(He10);
N:=He10;
He2:=` `;
Repeat
Y:=He10 Mod 2;
Str(Y, Tam);
He2:=Tam + He2;
He10:= He10 Div 2;
Until He10 = 0;
Writeln;
Writeln(`+So he 10 la : `,N);
Writeln(`+Doi sang he 2 la: `,He2);
Writeln;
Writeln(` Bam phim
Readln
End.
BT2 chuong 9
Program Doi_thap_phan_ra_bat_phan;
Var
He10,N,Y:Word;
He8,Tam:String;
Begin
Writeln(`DOI SO TU HE THAP PHAN SANG HE BAT PHAN`);
Writeln(` -----------------`);
Writeln;
Write(`-Nhap so nguyen he thap phan: `);
Readln(He10);
N:=He10;
He8:=` `;
Repeat
Y:=He10 Mod 8;
Str(Y, Tam);
He8:=Tam + He8;
He10:= He10 Div 8;
Until He10 = 0;
Writeln;
Writeln(`+So he 10 la : `,N);
Writeln(`+Doi sang he 8 la: `,He8);
Writeln;
Writeln(` Bam phim
Readln
End.
BT3 chuong9
Program Doi_thap_phan_ra_thap_luc;
Var
He10,N,Y:Word;
He16,Tam:String;
Begin
Writeln(`DOI SO TU HE THAP PHAN SANG HE THAP LUC PHAN`);
Writeln(` -----------------`);
Writeln;
Write(`-Nhap so nguyen he thap phan: `);
Readln(He10);
N:=He10;
He16:=` `;
Repeat
Y:=He10 Mod 16;
If Y < 10 Then
Str(Y, Tam)
Else
Tam:=Chr(Y+55);
He16:=Tam + He16;
He10:= He10 Div 16;
Until He10 = 0;
Writeln;
Writeln(`+So he 10 la : `,N);
Writeln(`+Doi sang he 16 la: `,He16);
Writeln;
Writeln(` Bam phim
Readln
End.
BT 4 chuong 9
Program Doi_thap_phan_ra_he_bat_ky;
Var
He10,N,Y,HeN:Word;
He,Tam:String;
Begin
Writeln(`DOI SO TU HE THAP PHAN SANG HE BAT KY`);
Writeln(` -----------------`);
Writeln;
Write(`-Nhap so nguyen he thap phan: `);
Readln(He10);
N:=He10;
Write(`-Doi sang he nao: `);
Readln(HeN);
He:=` `;
Repeat
Y:=He10 Mod HeN;
If Y < 10 Then
Str(Y, Tam)
Else
Tam:=Chr(Y+55);
He:=Tam + He;
He10:= He10 Div HeN;
Until He10 = 0;
Writeln;
Writeln(`+So he 10 la : `,N);
Writeln(`+Doi sang he: `,HeN:2,` la: `,He);
Writeln;
Writeln(` Bam phim
Readln
End.
BT 5 chuong 9
Program So_thu_Tu_ma_ASCII;
Var
St:String;
i:Byte;
Begin
Writeln(`SO THU TU MA ASCII CUA TUNG KY TU TRONG CHUOI`);
Writeln(` --------------------`);
Write(`-Nhap chuoi: `);
Readln(St);
Writeln;
For i:=1 To Length(St) Do
Write(` `,Ord(St[i]));
Writeln;
Writeln
* Một số tài liệu cũ có thể bị lỗi font khi hiển thị do dùng bộ mã không phải Unikey ...
Người chia sẻ: Lê Quang Phúc
Dung lượng: |
Lượt tài: 0
Loại file:
Nguồn : Chưa rõ
(Tài liệu chưa được thẩm định)