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;

var a:array[1..100]of integer;

i,n,t:integer;

begin

clrscr;

write('Nhap n='); readln(n);

for i:=1 to n do 

  begin

write('A[',i,']='); readln(a[i]);

end;

t:=0;

for i:=1 to n do 

  if a[i] mod 2<>0 then t:=t+a[i];

writeln(t);

readln;

end.

3:

const fi='dl.txt';

fo='kq.txt';

var f1,f2:text;

a:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

readln(f1,a);

writeln(f2,a);

close(f1);

close(f2);

end.

25 tháng 7 2021

cau 1:

uses crt;

var a:array[1..100] of integer;

n,i,min: integer;

begin

readln(n);

for i:=1 to n do

readln(a[i]);

min:=a[1];

for i:=2 to n do

if min>a[i] then min=a[i];

writeln(a[i]);

readln;

end.

cau 2:

uses crt;

g:text;

s:string;

const fo='CHUSO.TXT';

begin

assign(g,fo);

rewrite(g);

readln(s);

for i:=1 to length(s) do

if not((s[i] in ['a'..'z'])and(s[i] in ['A'..'Z])) then delete(s,i,1);

writeln(g,s);

end.

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.

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.

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

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

d:=length(st);

writeln('Xau vua nhap la: ',st);

for i:=1 to d do 

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

writeln('Xau moi la: ',st);

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.

1 tháng 9 2021

Program HOC24;

var s: string;

i: byte;

begin

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

for i:=1 to n do if not(s[i] in ['0'..'9']) then write(s[i]);

readln

end.

2:

uses crt;

var st:string;

d,i,dem1,dem2:integer;

begin

clrscr;

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

d:=length(st);

dem1:=0;

dem2:=0;

for i:=1 to d do

  begin

if st[i] in ['0'..'9'] then inc(dem1);

if (st[i] in ['a'..'z']) or (st[i] in ['A'..'Z']) then inc(dem2);

end;

writeln('So ki tu la chu so la: ',dem1);

writeln('So ki tu la chu cai la: ',dem2);

for i:=1 to d do 

  if st[i] in ['0'..'9'] then delete(st,i,1);

writeln('Xau sau khi xoa cac chu so la: ',st);

readln;

end. 

Bài 1:

uses crt;

var S:String;

vt:integer;

begin

clrscr;

Write(‘Nhap 1 xau:’); Readln(S);

While pos(‘nang’,s)>0 do

Begin

Vt:= pos(‘nang’,s);

Delete(s,vt,4);

Insert(‘mua’,s ,vt);

End;

Writeln(‘Xau sau khi thay the ’,s);

Readln;

End.

Bài 2: 

uses crt;

var st:string;

d,i,kt:integer;

begin

clrscr;

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

d:=length(st);

kt:=0;

for i:=1 to d do 

  if st[i]<>st[d-i+1] then kt:=1;

if kt=0 then writeln(st,' la xau doi xung')

else writeln(st,' khong la xau doi xung');

readln;

end.