关系表达式及逻辑表达式

1.已知a,b,c是三角形的三条边,判定这三条边能组成三角形的逻辑表达式是:
2.x是整型变量,判定x能被3整除,x能被7整除,但x不能被3和7同时整除的逻辑表达式是:

1.

mport math
#三角形三边a、b、c,必须满足:三条边长均大于零,并且任意两边之和大于第三边
a=int(input("请输入边长a:"))
b=int(input("请输入边长b:"))
c=int(input("请输入边长c:"))
if (a>0 and b>0 and c>0 and a+b>c and a+c>b and b+c>a):
    h = (a + b + c) / 2                  #周长的一半
    area = math.sqrt(h * (h - a) * (h - b) * (h - c))  #面积
    perimeter = a + b + c                     #周长
    height_a = 2 * area / a      #边长a所对应的高
    height_b = 2 * area / b      # 边长b所对应的高
    height_c = 2 * area / c      # 边长c所对应的高
    print("三角形的三条边为:{0}、{1}和{2}".format(a, b, c))
    print("三角形的面积为:{0:.2f}".format(area))
    print("三角形的周长为:{0:.2f}".format(perimeter))
    print("边长A对应的高为:{0:.2f}".format(height_a))
    print("边长B对应的高为:{0:.2f}".format(height_b))
    print("边长C对应的高为:{0:.2f}".format(height_c))
    if a**2 + b**2 == c**2 or b**2 + c**2 == a**2 or a**2 + c**2 == b**2:
        print("该三角形为直角三角形")
    elif a**2 + b**2 < c**2 or b**2 + c**2 < a**2 or a**2 + c**2 < b**2:
        print("该三角形为钝角三角形")
    elif a**2 + b**2 > c**2 or b**2 + c**2 > a**2 or a**2 + c**2 > b**2:
        print("该三角形为锐角三角形")
else:
    print("三条边:{0}、{1}和{2},不能构成三角形".format(a, b, c))

1.两边之和大于第三边

if(a+b>c&&a+c>b&&b+c>a)
{
    /* code */
}

2.

 if ((x % 3 == 0 && x % 7 != 0) || (x % 3 != 0 && x % 7 == 0))
    {
        /* code */
    }