Giải bài toán cổ Trăm Trâu với Pascal

Giải bài toán cổ Trăm Trâu với Pascal

Trâu đứng ăn năm

Trâu nằm ăn ba

Lụ khụ trâu già

Ba con một bó

Trăm con ăn cỏ

Trăm bó no nê.

Hỏi có bao nhiêu trâu đứng , trâu nằm , trâu già ?

Code:

Program Tram_trau;
Var
    dung,nam,gia,co,trau:Integer;
Begin
    Writeln('BAI TOAN CO DIEN');
   Writeln('Tram trau tram co');
   Writeln('Trau dung an 5');
   Writeln('Trau nam an 3');
   Writeln('Ba trau gia an 1');
   Writeln('----------------');
   Writeln('           Bai toan nay co cac loi giai sau');
   For dung:=0 To 20 Do
       For nam:=0 To 33-dung Do
          For gia:=0 To (100-(dung+nam)) Do
             Begin
                co:=5*dung+3*nam+(gia Div 3);
               trau:=dung+nam+gia;
               If (gia Mod 3 =0) And (trau=100) And ( co=100) Then
                   Writeln('-Trau dung ',dung,' con, -Trau nam ',nam,' con, -Trau gia ',gia,' con');
            End;
   Writeln;
   Writeln('   Bam phim <Enter> de ket thuc');
   Readln
End.   
Bạn thấy bài viết này như thế nào?: 
Average: 6.2 (21 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

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

 

Sử dụng drush để import/export DB

If the sql dump file is on a remote server, you can use this terminal command to download a copy of the sql file:

drupal 8

Xem qua 1 số chức năng Drupal 8, Plugins, Guzzle, CMI, Caching

So to recap, each broker has its own feed which can be filtered to return a list of web component urls. Those components could be injected into blocks through iframes for example.

Status trên Facebook lập kỷ lục khó tin

Status trên Facebook lập kỷ lục khó tin

Số ký tự cho phép trong một lần cập nhật trạng thái đã tăng lên ngưỡng 63.206 rồi nhé!

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

 

Diet con trung