Hãy cho biết chữ số lớn nhất 3452 của số tự nhiên vừa nhập

Hãy cho biết chữ số lớn nhất 3452 của số tự nhiên vừa nhập

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

Hãy cho biết chữ số lớn nhất của số tự nhiên vừa nhập.

Ví dụ 3452 có max là : 5

Bài giải

Program bt3;

Uses crt;

Var n , s , k, max: integer;     
    n1,temp:integer;                     

Begin

    Write('Nhap N:');                           

    Readln(N );                                        

    S := 0;
    
    max:= 0;
        
    While ( N <> 0 ) do                      

    Begin     

            k := N mod 10;                      

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

    End;
    

    writeln(max,' so lon nhat');
    

    Readln;

End.
Bạn thấy bài viết này như thế nào?: 
Average: 3.7 (9 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

 
Facebook muốn phủ sóng toàn thế giới

Facebook muốn phủ sóng toàn thế giới

Mạng xã hội hùng mạnh nhất thế giới hiện có khoảng 800 triệu thành viên, nhưng mục tiêu của Facebook không dừng lại ở đó.

[Phần 2] -Tạo trang Contact Page: Validators, Forms and Emailing

[Phần 2] -Tạo trang Contact Page: Validators, Forms and Emailing

Now we have the basic HTML templates in places, its time to make one of the pages functional. We will begin with one of the simplest pages; The Contact page.

Resizing Fields in Drupal 8 Without Losing Data

Hướng dẫn Resizing Fields trong Drupal 8 để không bị Losing Data

Drupal's field system is awesome and it is one of the reasons why I started using Drupal in the first place. However, there are some small limitations in it which surface from time to time.

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

 

Diet con trung