Adding Three Numbers In Python

Share:

 How To Add 3 Numbers Using Python Program:


After Writing This Code You Will Be Able To Add Any Three Numbers

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

a = int(input("Enter the 1st value: "))

b = int(input("Enter the 2nd value: "))

c = int(input("Enter the 3rd value: "))

sum = str( a + b + c)

print("your total amount is =" + sum )

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In This Code You Want To Take 3 User Inputs And Then Sum These input :

1:Write Any Variable suppose  I Take (a) as a variable.

2: Then Take User Input as integer (int)                         #int(input())

3:Now Write Something In Strings "" as a output 

4:After That you Are Able To Take User Input

5:Write Same as Take 2 ,3 input

6:Now Take A Variable As Sum

7:Write Sum=str(a + b + c)                                         #str for Apply + function. 

8:Then Write Print("Your total amount is=" + sum)  

    

9:NOTE: "Any Thing Write In Strings Print As It Is" 

 

So The Output is :

~~~~~~~~~~~~~~~~~~~~

Enter the 1st value: 10

Enter the 2nd value: 50

Enter the 3rd value: 40

your total amount is =100

~~~~~~~~~~~~~~~~~~~~~~