Program for addition of two number using Python

 This is a simple program for addition of two numbers using Python.

Program takes two numbers as input from the user and prints the sum as output.

#Simple Program for addition of two number without using function

print("Enter two numbers to be added")

#int can have numbers in the range -2147483648 through 2147483647

a=int(input()) #takes first number as input from user

b=int(input()) #takes second number as input from user

c=a+b          #adds two numbers a & b and saves to c

print("Addition of numbers {} and {} is {}".format(a,b,c))


Text in green color shows the comments

Output:

Enter two numbers to be added

123

123

Addition of numbers 123 and 123 is 246


Comments

Popular posts from this blog

IC555: Astable Multivibrator- LED blinking/Dancing

Continuous Wave Radar

Simple 2.4GHz dipole antenna program in MATLAB