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.

Bài 1:

uses crt;

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

n,i,j,tam:integer;

begin

clrscr;

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

for i:=1 to n do

begin

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

end;

for i:=1 to n-1 do

for j:=i+1 to n do

if a[i]>a[j] then

begin

tam:=a[i];

a[i]:=a[j];

a[j]:=tam;

end;

writeln('Day so sau khi sap xep la: ');

for i:=1 to n do

write(a[i]:4);

readln;

end.

Bài 2:

const fi='chucai.inp';
fo='chucai.equ';
var f1,f2:text;
s:array[1..255]of string;
dem,dem1,i,j:integer;
x:shortstring;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem:=0;
while not eof(f1) do
begin
inc(dem);
readln(f1,s[dem]);
end;
for i:=1 to dem do
begin
dem1:=0;
x:=s[i];
for j:=1 to length(x) do
if (x[j] in ['a'..'z']) or (x[j]in ['A'..'Z']) then inc(dem1);
writeln(f2,dem1);
end;
close(f1);
close(f2);
end.

const fi='input.txt';

fo='output.txt';

var f1,f2:text;

st:string[125];

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

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

begin

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

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

readln(f1,st);

d:=length(st);

dem:=1;

a[1]:=st[1];

for i:=1 to d do

  begin

kt:=0;

for j:=1 to dem do 

  if a[j]=st[i] 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(f2,a[i],' xuat hien ',dem1,' lan');

end;

close(f1);

close(f2);

end.

const fi='xau.inp';

fo='xau.out';

var f1,f2:text;

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

i,d:integer;

begin

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

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

n:=0;

while not eof(f1) do 

  begin

n:=n+1;

readln(f1,a[n]);

end;

for i:=1 to n do 

  begin

for j:=1 to length(a[i]) do 

  a[i][j]:=upcase(a[i][j]);

end;

for i:=1 to n do 

  writeln(f2,length(a[i]),' ',a[i]);

close(f1);

close(f2);

end.

#include <bits/stdc++.h>

using namespace std;

string st;

int d,i,dem;

int main()

{

freopen("xau.inp","r",stdin);

freopen("xau.out","w",stdout);

cin>>st;

d=st.length();

dem=0;

for (i=0; i<=d-1; i++)

if (st[i]=='a') dem++;

cout<<dem;

return 0;

}

18 tháng 2 2021

Program HOC24;

const fi='DL.INP';

fo='DL.OUT';

var s: string;

d,i: byte;

f: text;

procedure ip;

begin

assign(f,fi);

reset(f);

read(f,s);

close(f);

end;

procedure out;

begin

assign(f,fo);

rewrite(f);

d:=0;

for i:=1 to length(s) do if s[i] in ['0'..'9'] then inc(d);

write(f,d);

close(f);

end;

begin

ip;

out;

end.

const fi='dl.inp';

fo='kq.out';

var f1,f2:text;

s:string;

d,i,dem:integer;

begin

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

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

readln(f1,s);

d:=length(s);

dem:=0;

for i:=1 to d do 

  if s[i] in ['0'..'9'] then inc(dem);

writeln(dem);

readln;

end.