Saturday, March 20, 2021

Python: Addition of two numbers using function

Below is a simple addition program demonstrated using function addition. This program shows you how to use function in Python 

def addition(a,b): #This is funtion definitation

    c=a+b

    print("Addition = {}".format(c))

print("Enter two numbers to be added")

a=int(input())

b=int(input())

addition(a,b) #call the function addition() by passing two numbers a & b

Text in green are comments


Output:

Enter two numbers to be added

341

12

Addition = 353


No comments:

Post a Comment

Some useful parameters

Dielectric constant  Metals have infinite Dielectric constant  As usually metals permittivity is very large than of free space hence its Die...