uses crt;
Var n:byte;
begin
clrscr;
write('Nhap thu can dich: '); readln(n);
case n of
2: Write('Thu ',n,'Dich sang tieng Anh la: Monday');
3: Write('Thu ',n,'Dich sang tieng Anh la: Tuesday');
4: Write('Thu ',n,'Dich sang tieng Anh la: Wednesday');
5: Write('Thu ',n,'Dich sang tieng Anh la: Thursday');
6: Write('Thu ',n,'Dich sang tieng Anh la: Friday');
7: Write('Thu ',n,'Dich sang tieng Anh la: Saturday');
8: Write('Thu ',n,'Dich sang tieng Anh la: Sunday');
else
Write('Thu nay ko hop le');
end;
readln
end.
Lời giải :
program hotrotinhoc;
var n,i: integer;
begin
write('Nhap thu can dich :'); readln(n);
if n=1 then write('Chu nhat la Sunday');
if n=2 then write('Thu 2 la Monday');
if n=3 then write('Thu 3 la Tuesday');
if n=4 then write('Thu 4 la Wednesday');
if n=5 then write('Thu 5 la Thursday');
if n=6 then write('Thu 6 la Friday');
if n=7 then write('Thu 7 la Saturday');
for i:= 1 to 7 do if n<>i then write('Khong hop le');
readln
end.
uses crt;
var n:byte;
begin
write('Nhap thu can dich :'); readln(n);
if n=1 then write('Chu nhat la Sunday');
if n=2 then write('Thu 2 la Monday');
if n=3 then write('Thu 3 la Tuesday');
if n=4 then write('Thu 4 la Wednesday');
if n=5 then write('Thu 5 la Thursday');
if n=6 then write('Thu 6 la Friday');
if n=7 then write('Thu 7 la Saturday');
if (n>7)or(n<1) then ('ko hop ly');
readln
end.