Advertisement
Tran-Ba-Khai

Untitled

Jul 30th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. /*
  2. Bài 11:
  3. Điều kiện ràng buộc nhâpj còn thiếu
  4. Chị nhập số âm có được ko hở?
  5.  
  6. Sử dụng hàm sqrt chưa include thư viện
  7.  
  8. Nhắc bao lần rồi, không đưa code xử lý tính toán gộp trong printf
  9. code tính toán dài 1 dây thế kia gộp vào printf mà trông được à
  10. */
  11.  
  12. #include<conio.h>
  13. #include<stdio.h>
  14. #include<math.h>
  15.  
  16. int main()
  17. {
  18. float a, b, c, p, s;
  19.  
  20. do
  21. {
  22. printf("\n Nhap canh a = ");
  23. scanf("%f", &a);
  24. printf("\n Nhap canh b = ");
  25. scanf("%f", &b);
  26. printf("\n Nhap canh c = ");
  27. scanf("%f", &c);
  28. }
  29. while( a + b <= c || a + c <= b || b + c <= a || a <= 0 || b <= 0 || c <= 0 );
  30.  
  31. p = ( a + b +c ) / 2;
  32. s = sqrt(( p - a ) * ( p -b ) * ( p - c ) * p );
  33.  
  34. printf("\n\n Dien tich tam giac la : %0.2f ", s);
  35.  
  36. getch();
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement