
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.


uses crt;
var i,n,k,m: longint;
a:array[1..100000] of longint;
begin
clrscr;
write('Nhap n: ');readln(n);
write('Nhap k: ');readln(k);
while n<>0 do
begin
m:=n mod 10;
n:=n div 10;
i:=i+1;
a[i]:=m;
end;
if k<i then write(a[k]) else write('Ko tim duoc');
readln
end.

program baicuaban;
Var a:array [1..100] Of integer;
k,n,i,tam,x:integer;
Begin
Write('Nhap so phan tu n:');
ReadLn(n);
For i:=1 to n do
Begin
Write('a[',i,']=');
ReadLn(a[i]);
End;
For k:=1 to (n-1) do
For i:=1 to (n-1) do
If a[i] > a[i+1] then
Begin
tam:=a[i];
a[i]:=a[i+1];
a[i+1]:=tam;
End;
WriteLn('Mang da sap xep:');
For i:=1 to n do write(a[i],' ');
WriteLn;
Write('nhap vao so X :');
ReadLn(X);
i:=1;
While (x>a[i]) and(i<=n) do i:=i+1;
For k:=n+1 downto i do
a[k]:=a[k-1];
a[i]:=x;
Write('Mang da chen X:');
For i:=1 to n+1 do write(a[i],' ');
ReadLn;
End.
CHÚC BẠN HỌC TỐT.sai hãy liên hệ với mình, đúng tick cho mình nha
program baicuaban;
Var a:array [1..100] Of integer;
k,n,i,tam,x:integer;
Begin
Write('Nhap so phan tu n:');
ReadLn(n);
For i:=1 to n do
Begin
Write('a[',i,']=');
ReadLn(a[i]);
End;
For k:=1 to (n-1) do
For i:=1 to (n-1) do
If a[i] > a[i+1] then
Begin
tam:=a[i];
a[i]:=a[i+1];
a[i+1]:=tam;
End;
WriteLn('Mang da sap xep:');
For i:=1 to n do write(a[i],' ');
WriteLn;
Write('nhap vao so X :');
ReadLn(X);
i:=1;
While (x>a[i]) and(i<=n) do i:=i+1;
For k:=n+1 downto i do
a[k]:=a[k-1];
a[i]:=x;
Write('Mang da chen X:');
For i:=1 to n+1 do write(a[i],' ');
ReadLn;
End.

uses crt;
var x,k,i,t,lt,m,j,n:integer;
st:string;
a:array[1..255]of integer;
begin
clrscr;
write('nhap n='); readln(n);
writeln('Cac so Amstrong nho hon hoac bang ',n,' la: ');
for x:=1 to n do
begin
str(x,st);
k:=length(st);
for i:=1 to k do
val(st[i],a[i],m);
t:=0;
for i:=1 to k do
begin
lt:=1;
for j:=1 to k do
lt:=lt*a[i];
t:=t+lt;
end;
if t=x then write(x:4);
end;
readln;
end.

uses crt;
var n,k,d:longint;
st:string;
begin
clrscr;
write('n='); readln(n);
write('k='); readln(k);
if (n>=0) and (k>=0) then
begin
str(n,st);
d:=length(st);
if (k>d) or (k=0) then writeln('-1')
else writeln(st[k]);
end
else writeln('vui long nhap hai so tu nhien');
readln;
end.

Program TinhTong;
Uses crt;
Var S,i,n:Integer; // Khai bao bien su dung
BEGIN
Write( ‘ Nhap so n:’ ); // Thong bao nhap lieu
Readln( n ); // Nhap gtri N, (voi &N la lay d/c bien N)
S: = 0; // Khoi gan gia tri ban dau cho S
For i:=1 to n do // Lap voi moi i co gia tri tu 1 den N
S:=S + i; // Tinh tong cong don i vao S
Writeln( ‘Tong = ’, S); // Xuat ket qua tong S ra man hinh
Readln;
END.

PROGRAM In_Ma_Khoa;
USES crt;
VAR s:string;
Procedure Tong(x:string);
Var s2,i,s1,code:integer;
Begin
s2:=0;
for i:=1 to length(x) do
begin
val(x[i],s1,code);
s2:=s2+s1;
end;
write(s2);
End;
BEGIN
clrscr;
write('Nhap xau s:'); readln(s);
write('Ma khoa cua xau ki tu la:');
Tong(s);
readln;
END.
TONGXAU
const
fi='tongxau.inp';
fo='tongxau.out';
var
f:text;
a:array[1..32000] of char;
t,s,so,nul,i,n:integer;
procedure inp;
begin
assign(f,fi);
reset(F);
n:=0;
while not(eof(f)) do
begin
inc(n);
read(f,a[n]);
end;
close(F);
end;
procedure out;
begin
assign(f,fo);
rewrite(F);
i:=1 ;
s:=0;
while i<=n do
begin
t:=0;
while a[i] in ['0'..'9'] do
begin
val(a[i],so,nul);
t:=t*10+so;
inc(i);
end;
s:=s+t ;
inc(i);
end;
write(f,s);
close(f);
end;
BEGIN
INP;
OUT;
END.

010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001010010110101011010101001001001011010111101000111001010101101010010101011011101001011010101000100101001011010101101010100100100101101011110100011100101010110101001010101101110100101101010100010010100101101010110101010010010010110101111010001110010101011010100101010110111010010110101010001001