K
Khách

Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.

1:

uses crt;

const fi='ketqua.txt';

var f1:text;

st:string;

i,d:integer;

begin

clrscr;

assign(f1,fi); rewrite(f1);

write('Nhap xau:'); readln(st);

d:=length(st);

for i:=1 to d do 

 if st[i]=#32 then delete(st,i,1);

writeln(f1,st);

close(f1);

end.

2:

uses crt;

var a,b,c,d:integer;

{----------chuong-trinh-con-----------------------}

function min(x,y:integer):integer;

begin

if x<y then min:=x

else min:=y;

end;

{---------------chuong-trinh-chinh--------------------}

begin

clrscr;

write('a='); readln(a);

write('b='); readln(b);

write('c='); readln(c);

write('d='); readln(d);

writeln(min(a,min(b,min(c,d))));

readln;

end.

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

readln(st);

d:=length(st);

for i:=1 to d do 

  if (st[i]<>'a') and (st[i]<>'A') then write(st[i]);

readln;

end.

26 tháng 2 2021

Bài 1:

Program HOC24;

var s: string;

i: byte;

begin

write('Nhap xau : '); readln(s);

while s[1]=#32 do delete(s,1,1);

while pos(#32#32,s)<>0 do delete(s,pos(#32#32,s),1);

while s[length(s)]=#32 do delete(s,length(s),1);

for i:=1 to length(s) do

if s[i]=#32 then writeln(s[i]) else write(s[i]);

writeln;

readln

end.

Bài 2:

Program HOC24;

var s: string;

i: byte;

begin

write('Nhap xau : '); readln(s);

while s[1]=#32 do delete(s,1,1);

while pos(#32,s)<>0 do delete(s,pos(#32,s),1);

while s[length(s)]=#32 do delete(s,length(s),1);

writeln('Xau sau khi xoa ki tu trong: ',s);

readln

end.

26 tháng 2 2021

Bài 3:

Program HOC24;

var s: string;

i: byte;

begin

write('Nhap xau : '); readln(s);

for i:=1 to length(s) do s[i]:=upcase(s[i]);

write('Xau sau khi in hoa : ',s);

readln

end.

Bài 4:

Program HOC24;

var s: string;

i: byte;

begin

write('Nhap xau : '); readln(s);

write('Xau sau khi dao nguoc: ');

for i:=length(s) downto 1 do write(s[i]);

readln

end.

uses crt;

const fi='dulieu.txt';

var f1:text;

st:string;

i,d:integer;

begin

clrscr;

assign(f1,fi); rewrite(f1);

write('Nhap xau:'); readln(st);

d:=length(st);

for i:=1 to d do 

if (st[i] in ['A'..Z']) or (st[i] in ['0'..'9']) or (st[i]=#32) then write(f1,st[i]);

close(f1);

end.

Bài 3: 

uses crt;

const fi='teptong.txt';

var a,b:integer;

f1:text;

begin

clrscr;

assign(f1,fi); rewrite(f1);

readln(a,b);

writeln(a+b);

writeln(f1,a+b);

close(f1);

readln;

end.

28 tháng 4 2021

Program HOC24;

var s: string;

i: byte;

begin

write('Nhap xau :'); readln(s);

for i:=1 to length(s) do if s[i]<>'a' then write(s[i]);

readln

end.

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

for i:=1 to d do 

 if st[i]='a' then delete(st,i,1);

writeln(st);

readln;

end.

Cách 1: Có sử dụng chương trình con

uses crt;

var st:string;

{------------chuong-trinh-con-------------------}

function doi(st1:string):string;

var i,d:integer;

begin

d:=length(st1);

for i:=1 to d do 

  st1[i]:=upcase(st1[i]);

doi:=st1;

end;

{-------------------chuong-trinh-chinh--------------------}

begin

clrscr;

write('Nhap xau:'); readln(st);

writeln(doi(st));

readln;

end.

Cách 2: Không sử dụng chương trình con

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

write('Nhap xau:'); readln(st);

d:=length(st);

for i:=1 to d do 

  st[i]:=upcase(st[i]);

writeln(st);

readln;

end.