a =20
b =10
c =15
d =5
e =(a + b) * c / d;-- (30 * 15) / 5
print("Value of (a + b) * c / d is :",e )
e =((a + b) * c) / d; -- (30 * 15) / 5
print("Value of ((a + b) * c) / d is :",e )
e =(a + b) * (c / d);-- (30) * (15/5)
print("Value of (a + b) * (c / d) is :",e )
e = a + (b * c) / d; -- 20 + (150/5)
print("Value of a + (b * c) / d is :",e )
当您构建并执行上述程序时,它会产生以下结果 -
Value of (a + b) * c / d is :90
Value of ((a + b) * c) / d is :90
Value of (a + b) * (c / d) is :90
Value of a + (b * c) / d is :50