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.

Câu 1:

uses crt;
var s:string;
i,d,dem:integer;
begin
clrscr;
write('nhap xau S:'); readln(s);
d:=length(s);
dem:=0;
for i:=1 to d do
if s[i]='a' then inc(dem);
writeln('so lan xuat hien cua chu a trong xau ',s,' la: ',dem);
readln;
end.

Câu 2:

uses crt;
var a:array[1..99]of integer;
n,i,k:integer;
s:longint;
begin
clrscr;
repeat
write('nhap n='); readln(n);
if n>=100 then writeln('nhap lai');
until n<100;
for i:=1 to n do
begin
repeat
write('a[',i,']='); readln(a[i]);
if a[i]>=3000 then writeln('nhap lai');
until a[i]<3000;
end;
write('nhap so k:'); readln(k);
s:=1;
for i:=1 to n do
if k mod a[i]=0 then s:=s*a[i];
writeln('tich cac uoc cua ',k,' trong day la: ',s);
readln;
end.

14 tháng 4 2020

b1:

user crt;

var s:string;

d,i:byte;

begin

clrscr;

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

for i:=1 to length(s) do

if s[i] = 'a' then inc(d);

writeln('Chu a xuat hien ',d,' lan');

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.

3 tháng 3 2021

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.

uses crt;

var st:string;

i,d:integer;

begin

clrscr;

readln(st);

d:=length(st);

for i:=1 to d do 

begin  

if st[i]=' ' then writeln

else write(st[i]);

end;

readln;

end.

16 tháng 3 2022

Uầy đỉnh thế

uses crt;

var st:string;

a:array[1..255]of string;

i,d,dem,kt,j,dem1:integer;

begin

clrscr;

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

d:=length(st);

a[1]:=st[1];

dem:=1;

for i:=1 to d do 

  begin

kt:=0;

for j:=1 to dem do 

  if st[i]=a[j] then kt:=1;

if kt=0 then 

begin

inc(dem);

a[dem]:=st[i];

end;

end;

for i:=1 to dem do 

  begin

dem1:=0;

for j:=1 to d do 

  if a[i]=st[j] then inc(dem1);

writeln(a[i],' xuat hien ',dem1,' lan');

end;

readln;

end.

27 tháng 2 2023

uses crt;

var a:string;

     c:char;

     i,dem:integer;

begin

    clrscr;

    readln(a);

    readln(c);

    dem:=0;

    for i:=1 to length(a) do

    if a[i]=c then dem:=dem+1;

    writeln(dem);

    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.

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.

Câu 1: 

uses crt;

var st:string;

d,i,dem:integer;

begin

clrscr;

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

d:=length(st);

write('Xau sau khi xoa so la: ');

for i:=1 to d do 

  if not(st[i] in ['0'..'9']) then write(st[i]);

writeln;

dem:=0;

for i:=1 to d do 

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

writeln('Xau co ',dem,' dau cach');

writeln('Do dai cua xau la: ',d);

readln;

end. 

Câu 2: 

uses crt;

const fi='kq.out';

var st1,st2:string;

f1:text;

begin

clrscr;

write('Nhap xau thu 1:'); readln(st1);

write('Nhap xau thu 2:'); readln(st2);

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

if length(st2)>length(st1) then writeln(f1,st2)

else writeln(f1,st1);

close(f1);

end.

uses crt;

var st:string;

i,d,dem:integer;

ch:char;

begin

clrscr;

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

write('Nhap ki tu:'); readln(ch);

d:=length(st);

dem:=0;

while pos(ch,st)>0 do 

  begin

inc(dem);

delete(st,pos(ch,st),1);

end;

writeln(dem);

readln;

end.