Python Program to Add Two Numbers
- Add two number using Static method
- Add two number given by user
Method 1:
Python Program to Add Two Numbers(Static method )
a = 3 // variable declaration
b = 8
sum = a + b // Arithmetic Calculation
print("sum:", sum) // display function
Output
sum: 11
Method 2:
Python Program to Add Two Number (Value given by User)
a = int(input("enter first number: ")) // variable declaration //user defined value
b = int(input("enter second number: "))
sum = a + b // Arithmetic Calculation
print("sum:", sum) // display function
Output
enter first number:3
enter second number:8
sum: 11