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.
Chương trình:program bai_10_chuong_4;uses crt;vars: string[100];i, dem: integer;Beginclrscr;write('Nhap xau vao:'); readln(s); dem:= 0;for i:= 1 to length(s) doif ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;Writeln('Trong xau s co '»dem,' chu so thap phan');readln;End.
program bai_10_chuong_4;
uses crt;
var
s: string[100];
i, dem: integer;
Begin
clrscr;
write('Nhap xau vao:'); readln(s); dem:= 0;
for i:= 1 to length(s) do
if ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;
Writeln('Trong xau s co '»dem,' chu so thap phan');
readln;
End.
uses crt;
var st:string[100];
i,d,kt:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
kt:=0;
for i:=1 to length(st) do
if st[i]<>st[length(st)-i+1] then kt:=1;
if kt=0 then write('Xau doi xung')
else writeln('Xau khong doi xung');
readln;
end.
Chương trình:
program bai_10_chuong_4;
uses crt;
var
s: string[100];
i, dem: integer;
Begin
clrscr;
write('Nhap xau vao:'); readln(s); dem:= 0;
for i:= 1 to length(s) do
if ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;
Writeln('Trong xau s co '»dem,' chu so thap phan');
readln;
End.
uses crt;
var st:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
writeln('Xau vua nhap la: ',st);
dem:=0;
for i:=1 to d do
if st[i] in ['0'..'9'] then inc(dem);
writeln(dem);
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.
uses crt;
var st,s:string;
i,d,dem,kt,j,dem1:integer;
begin
clrscr;
write('Nhap xau:'); readln(s);
writeln('Xau vua nhap la: ',s);
d:=length(s);
for i:=1 to d do
if s[i]=#32 then delete(s,i,1);
dem:=1;
st[1]:=s[1];
for i:=1 to d do
begin
kt:=0;
for j:=1 to dem do
if s[i]=st[j] then kt:=1;
if kt=0 then
begin
inc(dem);
st[dem]:=s[i];
end;
end;
for i:=1 to dem do
begin
dem1:=0;
for j:=1 to d do
if st[i]=s[j] then inc(dem1);
writeln(st[i],' xuat hien ',dem1,' lan');
end;
readln;
end.
Program HOC24;
var s: string;
i,d: byte;
begin
write('Nhap xau :'); readln(s);
d:=0;
for i:=1 to length(s) do if s[i]=' ' then d:=d+1;
write('Xau ',s,' co ',d,' ki tu cach');
readln
end.
uses crt;
var s:string;
i,d,dem:integer;
begin
clrscr;
write('Nhap xau:); readln(s);
d:=length(s);
dem:=0;
for i:=1 to d do
if s[i]=#32 then inc(dem);
writeln(dem);
readln;
end.
Program HOC24;
var s: string;
tg,d,max,i: byte;
code: integer;
begin
write('Nhap xau : '); readln(s);
// cau a
for i:=1 to length(s) do if s[i] in ['a'..'z'] then write(upcase(s[i]));
//------
writeln;
//-cau b
for i:=length(s) downto 1 do if s[i] in ['0'..'9'] then write(s[i]);
//------
writeln;
//---cau c
d:=0;
for i:= 1 to length(s) do
if s[i] in ['0'..'9'] then
begin
val(s[i],tg,code);
if tg>max then max:=tg;
d:=d+1;
end;
if d=0 then write('Khong co chu so trong day') else write('Chu so lon nhat la : ',max);
readln
end.
uses crt;
var st,st1:string;
d,i,d1,max,x,y:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
writeln('Day cac ki tu thuong doi sang chu hoa la: ');
for i:=1 to d do
if st[i] in ['a'..'z'] then write(upcase(st[i]):4);
st1:='';
for i:=1 to d do
if st[i] in ['0'..'9'] then st1:=st1+st[i];
d1:=length(st1);
for i:=d1 downto 1 do
write(st1[i]:4);
writeln;
max:=0;
for i:=1 to d1 do
begin
val(st1[i],x,y);
if max<x then max:=x;
end;
writeln('Chu so lon nhat trong xau la: ',max);
readln;
end.
câu 1 Uses Crt;
Var St:String;
dem: Array[‘A’..’Z’] Of Byte
; i:Byte;
ch:Char;
Begin Write(‘Nhap xau St: ‘);
Readln(St);
{Khởi tạo mảng} For ch:=’A’ To ‘Z’ Do dem[ch]:=0;
{Duyệt xâu} For i:=1 To Length(St) Do If Upcase(St[i]) IN [‘A’..’Z’] Then Inc(dem[Upcase(St[i])]);
{Liệt kê các ký tự ra màn hình} For ch:=’A’ To ‘Z’ Do If dem[ch]>0 Then Writeln(ch,’ : ’,dem[ch]);
Readln;
Hehe,con sâu