Nhập vào số tự nhiên 32123 kiểm tra tính đối xứng

Nhập vào số tự nhiên 32123 kiểm tra tính đối xứng

Nhập vào 1 số tự nhiên N với (0 < N ≤ 65535).

Kiểm tra xem số đó có đối xứng không.

Bài giải

Program bt3;

Uses crt;

Var n , k,i, max: integer;     
     s1,st:STRING;
    
    
Function IntToStr (I : Longint) : String;
Var S : String;
begin
 Str (I,S);
 IntToStr:=S;
end;

Begin
    Clrscr;

    Write('Nhap N:');                           

    Readln(N );
    
    st:= IntToStr(N);
    
    max:= 0;
        
    While ( N <> 0 ) do                      

    Begin     

            k := N mod 10;                      

            N :=  N div 10;  
            
            if max < K then max:=K;            

    End;        
    
    n:=length(st);

    s1:='';
    
    for i:=n downto 1 do s1:=s1+st[i];

    if st=s1 then writeln(max, ' doi xung:')

    else writeln(max, ' khong doi xung:');

    Readln;

End.
Bạn thấy bài viết này như thế nào?: 
Average: 8.7 (7 votes)
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Bình luận (0)

 

Add Comment

Filtered HTML

  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Các thẻ HTML được chấp nhận: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Tự động ngắt dòng và đoạn văn.

Plain text

  • No HTML tags allowed.
  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Tự động ngắt dòng và đoạn văn.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Từng bước sao lưu dữ liệu tài khoản Facebook trước khi quá trễ

Từng bước sao lưu dữ liệu tài khoản Facebook trước khi quá trễ

Facebook - Mạng xã hội phổ biến nhất thế giới với khoảng 1,2 tỉ người dùng vừa bị mất kết nối

6 lý do để bạn chọn Bootstrap CSS Framework

6 lý do để bạn chọn Bootstrap CSS Framework

For those of you, who like me have been developing websites for few years, we tend to use similar chunks of CSS code that we copy paste from project to project.

Phần 2 xây dựng Responsive Theme trong Drupal 7

Phần 2 xây dựng Responsive Theme trong Drupal 7

The objective of this section is to make the primary menu a toggle menu for the mobile interface. i.e the menu renders on click in mobile devices and is horizontal on screens wider than 600px.

Công ty diệt chuột T&C

 

Diet con trung