Addition of two numbers in Python Programming Language

Avatar

 BY TEJAS




Python is a very Important Language in today's computer world. Python use everywhere in OS, Hardware, Softwares, and also in Websites.



In this example, we assign 2 int constants. In the first int value of "a" is stored which is taken from the user and similarly, In second int value of "b" is stored.
Then simply we write our formula

sum = a + b

then we add function print() for printing the Output to the Screen.

That's It.
This is a very Simple Example.

Add 2 Nums in Python

In below video shows execution of this program



below here is a Python code and output of Python program.

Extension of Python Program is .py


add2nums.py :-
    
        a = int(input("enter first number: "))
        b = int(input("enter second number: "))
         
        sum = a + b
         
        print("sum:", sum)
    
    


output :-
    
        enter first number:5
        enter second number:95

        sum: 100

    
  
    
        a = int(input("enter first number: "))
        b = int(input("enter second number: "))
         
        sum = a + b
         
        print("sum:", sum)

    


output :-
    
     
    enter first number:5
    enter second number:95

    sum: 100

    
  
Search
Advertisement
Share With
Follow us on
Advertisement