#Bài 3
-xác định thuật toán
+input
nhập 6 số
x1, y1( toạ độ điểm A)
x2 ,y2 ( toạ độ điểm B)
x3 ,y3 ( toạ độ điểm C )
+output
độ dài AB
độ dài BC
độ dài AC
-thuật toán
+nhập x1 y1 x2 y2 x3 y3
+tính dab = sqrt (pow(x2-x1,2)+pow(y2-y1,2))
+dbc= sqrt (pow(x3-x2,2)+pow(y3-y2,2))
+dac= sqrt (pow(x3-x1,2)+pow(y3-y1,2))
+in ra
dab
dbc
dac
-chương trình
from math import sqrt
from math import pow
x1 = float(input())
y1 = float(input())
x2 = float(input())
y2 = float(input())
x3 = float(input())
y3 = float(input())
dab= sqrt (pow(x2-x1,2)+pow(y2-y1,2))
dbc= sqrt (pow(x3-x2,2)+pow(y3-y2,2))
dac= sqrt (pow(x3-x1,2)+pow(y3-y1,2))
print("{:.3f}".format(dab))
print("{:.3f}".format(dbc))
print("{:.3f}".format(dac))
-tét ví dụ
1
2
3
2
1
2
+KQ
2
2
0