Bài 1. Từ máy tính đến Mạng máy tính

VH

cho hỏi vui

công thức tìm số đối xứng trong pascal

 

 

 

ND
15 tháng 10 2016 lúc 13:16

Uses crt;
var st: string;
function KT (xau: string): boolean;
var i, dem: integer;
begin
dem:=0;
for i:= 1 to length(st) div 2 do
if xau<>xau[length(xau)-i+1] then inc(dem);
if dem<>0 then KT:=False else KT:=True;
end;
begin
clrscr;
write ('Nhap so co do dai khong qua 100 chu so: '); readln (st);
if length(st)>100 then
begin
write ('Nhap khong hop le! An Enter va chay lai!');
readln; exit;
end;
if KT(st)=True then write ('Day la so doi xung!') else write ('Day la so khong doi xung!');
readln
end.

Bình luận (1)
H24
1 tháng 5 2017 lúc 21:54

procedure bai1;
var
n,n1,temp:integer;
BEGIN
repeat
clrscr;
write('Nhap vao so n=');
readln(n);
if((n>-32000) and (n<32000) )then break;
until (1=1);
n1:=0;
temp:=n;
while temp>0 do
begin
n1:=n1*10 + temp mod 10;
temp:= temp div 10;
end;
if n1=n then writeln('Doi xung')
else
writeln('Khong doi xung');
END;

Bình luận (2)
DT
27 tháng 11 2020 lúc 10:24

Function sdx (l:longint):boolean;
var s:string;
i,m:longint;
Begin
sdx:=false;
str(l,s);
m:=length(s);
for i:= 1 to m div 2 do
if s[i]=s[m-i+1] then
sdx:=true
else
sdx:=false;
End;
Procedure sodoixung(var a:mat);
Begin
write('cac so doi xung la: ');
for i:= 1 to n do
if sdx(a[i]) then
write(a[i]:4);
End;
Còn phần mảng bạn tự làm nha

Bình luận (0)
 Khách vãng lai đã xóa

Các câu hỏi tương tự
DA
Xem chi tiết
TK
Xem chi tiết
BN
Xem chi tiết
HS
Xem chi tiết
LD
Xem chi tiết
TD
Xem chi tiết
LT
Xem chi tiết
VD
Xem chi tiết
TT
Xem chi tiết