We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Arithmetic Operators
Arithmetic Operators
Sort by
recency
|
1043 Discussions
|
Please Login in order to post a comment
it was not accepting the commented code if name == 'main': a = int(input()) b = int(input()) #print("The sum of", a, "and", b, "is:", (a+b)) #print("The difference of", a, "and", b, "i:", (a-b)) #print("The product of", a, "and", b, "is:", (a*b)) print(a+b) print(a-b) print(a*b)
https://cdn.shopify.com/s/files/1/0779/2073/1459/files/High-Waist-With-Shaping-Panty-In-USA.jpg?v=1714042580
Approach A: We can use f string
print(f'{a+b}\n{a-b}\n{a*b}')
Approach B: if name == 'main': a = int(input()) b = int(input())
*result will unpack the tuple, 'sep' argument of print will separate the values in tuple with new line
A
a = int(input()) b = int(input())
c = a/b d = c//b
print(c) print(d)
a=int(input()) b=int(input()) c=a+b d=a-b e=a*b print(c) print(d) print(e)