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
PGD FF
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 1 2021 lúc 9:25

const fi='timmax.inp'     

fo='timmax.out'

var f1,f2:text;   

st,xauso:ansistring;   

d,i,max,x:longint;

begin

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

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

readln(f1,st);

d:=length(st);

xauso:=''

max:=0;

for i:=1 to d do 

if st[i] in ['0'..'9'] then xauso:=xauso+st[i] 

else begin         

              val(xauso,x);         

              if max<=x then max:=x;         

              xauso:=''       

        end;

if max=0 then writeln(f2,'-1')

else writeln(f2,max);

close(f1);

close(f2);

end.

Bình luận (0)
LA VAN CAU
Xem chi tiết
Hello1234
Xem chi tiết
Kiều Vũ Linh
27 tháng 3 2022 lúc 10:26

var s:string;

i:integer;

begin

write('Nhap xau ki tu S = ');readln(s);

for i:=1 to length(s) do

begin

if s[i] <> '0' then write('Vi tri cua so 0 cuoi cung la ',i-1);

i:=length(s);

end;

readln;

end.

Bình luận (0)
Nguyễn An
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 7 2021 lúc 14:32

uses crt;

var s,s1,s2:string;

i,d:integer;

begin

clrscr;

readln(s);

s1:=''

s2:=''

d:=length(s);

for i:=1 to d do

  begin

if s[i] in ['0'..'9'] then s1:=s1+s[i];

if (s[i] in ['a'..'z']) or (s[i] in ['A'..'Z']) then s2:=s2+s[i];

end;

writeln('Xau chua cac ki tu so la: ',s1);

writeln('Xau chua cac ki tu chu la: ',s2);

readln;

end.

Bình luận (0)
Lê Chiêu Nguyên	Vũ
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)