Bài toán Pascal: Ngược lại, thì in diện tích, chu vi của tam giác ra màn hình

Bài toán Pascal: Ngược lại, thì in diện tích, chu vi của tam giác ra màn hình

Tính tam giác: Nụâp vào ba số a,b,c bất kì. Kiểm tra xem nó có thể  là độ dài ba cạnh hay không, nếu  không  thì in  ra màn  hình  ' Khong la ba  canh cua mot tam  giac'. Ngược lại, thì in diện tích, chu vi của tam giác ra màn hình.

Program TAMGIAC; 

Uses crt;

Var a,b,c,s,p : real; 

Begin

  Clrscr;

  Writeln(‘BAI TOAN TAM GIAC:’);

  Writeln('---------------------------------'); 

  Write('nhap a =');

  readln(a);

  Write ('nhap b =');

  readln(b); 

  Write('nhap c =');

  readln(c);

  If ((a+b)>c)and((b+c)>a)and((a+c)>b) then

  Begin

    p:=(a+b+c)/2;

    s:=sqrt(p*(p-a)*(p-b)*(p-c)); 

    Writeln('Chu vi tam giac:',2*p:4:2) ; 

    Writeln('Dien tich tam giac:',s:4:2);

  End

  Else

    Writeln(a,’, ‘, b,’, ‘, c, ‘ khong phai la ba canh cua tam giac') ; 

    Readln;

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

 
www.Sothichweb.com được làm mới

www.Sothichweb.com được làm mới

Phong cách thiết kế luôn có sự thay đổi, sự đơn giản sẽ là xu thế lâu dài bởi cuộc sống ngày càng phức tạp và chúng ta sẽ muốn tiếp nhận những cái đơn giản, đơn giản không phải là bỏ đi những chức năng cần thiết mà bỏ đi những thứ ít cần thiết hơn

Teens Exploring Technology tạo sự khác biệt gì tại South Los Angeles?

Teens Exploring Technology tạo sự khác biệt gì tại South Los Angeles?

Oscar was looking into Drupal as a potential technology to include in the summer coding academy his organization holds every year.

DrupalCon Austin monitoring session submissions

DrupalCon Austin monitoring session submissions

This is my fifth DrupalCon monitoring session submissions. My fifth time nervously counting the submissions as they come rolling in, first at a trickle, maybe 20 in a week. Then stagnation, followed by a bit of a panic - did we remember to tell people??

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

 

Diet con trung