Code Pascal: Nhập vào một số, kiểm tra số có đối xứng hay không

Người đăng: share-nhungdieuhay on Thứ Tư, 6 tháng 3, 2013


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;

{ 0 nhận xét... read them below or add one }

Đăng nhận xét