Những câu hỏi liên quan
U Lan
Xem chi tiết
U Lan
Xem chi tiết
U Lan
Xem chi tiết
U Lan
Xem chi tiết
Nguyễn Thị Hòa
Xem chi tiết
Anh Phạm
25 tháng 7 2021 lúc 20:51

uses crt;

var s:string;

i,tong,x,code:integer;

f,g:text;

k:boolean;

const fi='XAU.INP'

          fo='XAU.OUT'

begin

k:=false;

assign(f,fi); reset(f);

assign(g,fo); rewrite(g);

readln(f,s);

tong:=0;

for i:=1 to length(s) do

begin

if s[i] in ['0'..'9'] then

begin

k:=true;

val(s[i],x,code);

tong:=tong+x;

x:=0;

cod:=0;

end;

end;

if k=false then writeln(g,'Sai yeu cau')

else

begin

writeln(g,s);

writeln(g,tong);

end;

close(f);

close(g);

end.

Bình luận (0)
feng
Xem chi tiết
nguyễn an phát
24 tháng 5 2022 lúc 10:59

program bai1;
uses crt;
var i:integer;
s,s1:string;
begin
  clrscr;
  write('nhap S:');readln(s);
  while pos('C',s)<>0 do
  begin
    insert('LOP11A',s,pos('C',s));
    delete(s,pos('C',s),1);
  end;
  writeln('xau sau khi bien doi la: ',s);
  writeln('do dai cua xau tren la: ',length(s));
  write('nhap s1:');readln(s1);
  if s1[1]=s[1] then writeln('ki tu dau cua hai xau trung nhau')
  else writeln('ki tu dau cua hai xau khong trung nhau');
  readln;
end.

Bình luận (0)
Phương Vũ Hà
Xem chi tiết
Nguyễn Lê Phước Thịnh
26 tháng 3 2021 lúc 16:05

uses crt;

var s:string;

i,d:integer;

begin

clrscr;

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

d:=length(s);

for i:=1 to d do 

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

writeln('Xau sau khi xoa het ki tu chu la: ',s);

readln;

end.

Bình luận (0)
Thangg PH
Xem chi tiết
Minh Lệ
3 tháng 4 2021 lúc 18:54

Program HOC24;

var S: string;

d,i: byte;

begin

write('S= '); readln(s);

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

writeln;

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

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

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

d:=0;

for i:=1 to length(s) do d:=d+1;

write('So tu :',d);

readln

end.

Bình luận (1)
Nguyễn Lê Phước Thịnh
3 tháng 4 2021 lúc 19:16

uses crt;

var s:string[200];

i,d,dem:integer;

begin

clrscr;

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

d:=length(s);

write('Xau viet theo chieu nguoc la: ');

for i:=d downto 1 do 

  write(st[i]);

writeln;

dem:=0;

for i:=1 to d do 

  if st[i]=#32 then inc(dem);

writeln('So tu la: ',dem);

readln;

end.

Bình luận (1)
nguyễn linh
Xem chi tiết