câu 1:
a)
Var s: string;
Begin
Write('nhap xau: '); readln(s);
While pos(' ', s)<>0 do
Delete(s, pos(' ', s), 1);
Write(s);
Readln
End.
b)
Var s: string;
i: byte;
Begin
Write('nhap xau: '); readln(s);
For i:=1 to length(s) do
If s[i] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] then write(s[i]);
Readln
End.
câu 2:
a)
Var f: text;
a, b: integer;
Begin
Assign(f, 'BAI2.INP'); reset(f);
Read(f, a, b); close(f);
Write(a+b);
Readln
End.
b)
Var f: text;
a, b: integer;
Begin
Assign(f, 'BAI2.OUT'); rewrite(f);
Write('nhap a va b: '); readln(a, b);
Write(f, a+b); close(f);
End.
câu 3:
a)
Procedure tong;
Begin
S := a + b;
End;
b)
Function tong(x, y: integer): longint;
Begin
Tong := x + y;
End;