Programming
Write a program that will print the results of the four
operations enumerated below:
➢ -1 + 4 * 6
➢ ( 35+ 5 ) % 7
➢ 14 + -4 * 6 / 11
➢ 2 + 15 / 6 * 1 - 7 % 2
Then, assign the resulting numbers for each of the
operations to corresponding int variables, add them
together, and use the decrement operator once to make
it so that the result displays “42”.
Share
Answer:
# is text-coding, Python language
Explanation:
# 4 operations enumerated below
a = -1 + 4 * 6
b = (35+5) % 7
c = 14 + -4 * 6 / 11
d = 2 + 15 / 6 * 1 - 7 % 2
# Printing A - D
print(a)
print(b)
print(c)
print(d)
# Decremental Operator
x = a+b+c+d
x -= 1
# Print X
print(x)
# If you want "x" to be rounded to 42
print(round(x))