Arithmetic Operations in Python
Python has mathematical operators used for arithmetic operations. In this article, we will learn about basic arithmetic operations and one program which finds Odd-Even numbers. Odd are those which cannot be divided by 2 while even numbers are exactly divided by 2.
num1 = 7
num2 = 4
# Multiplication
ans = num1 * num2
# Addition
ans = num1 + num2
# Substraction
ans = num1 - num2
# Division
ans = num1 / num2
# Remainder
ans = num1 % num2
# % is called modulus operator which return remainder
num = 7
# Program to find Odd Even number
if num % 2 == 0:
print("Even")
else:
print("Odd")
Github:
https://github.com/asadraza825/pythonTags: Python, Python Programming, Python Arithmetic operations, Arithmetic operators