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.1 (8 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

 
[LimoenGroen]: Continuous Integration & Drupal là gì?

[LimoenGroen]: Continuous Integration & Drupal là gì?

Continuous integration (CI) is the practice of frequently integrating one's new or changed code with the existing code repository.

Ví dụ Design Pattern: tác giả Eric Evens

Ví dụ Design Pattern: tác giả Eric Evens

The Repository Design Pattern, defined by Eric Evens in his Domain Driven Design book, is one of the most useful and most widely applicable design patterns ever invented.

Hướng dẫn nâng cấp Drupal 6 lên Drupal 7 hay Drupal 8

Hướng dẫn nâng cấp Drupal 6 lên Drupal 7 hay Drupal 8

Drupal 8 is not backward compatible, I think that's a good thing: you don't want to drag legacy stuff behind you. That's a big bucket on your boat.

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

 

Diet con trung