Program for addition of two numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Program for addition of two numbers

13th Aug 2017, 3:32 AM
Šháśhïşh Míśhřä
Šháśhïşh Míśhřä - avatar
7 Answers
+ 6
Firstly,assign the the numbers to two different variables then add them and assign the sum to a new third variable.... U print out A =5 B = 2 C = A+B print(C) This should work for Python
13th Aug 2017, 3:55 AM
Uzoma Collins Arinze
Uzoma Collins Arinze - avatar
+ 2
a = 5 b = 2 c = a+b print (c)
13th Aug 2017, 3:36 AM
Akash Jaiswal
Akash Jaiswal - avatar
+ 2
def my_function(a,b): a = int(a) b = int(b) result = int(a) + int(b) print(result) my_function(5,2) or def add(x,y) return x+y print(add(5,2))
13th Aug 2017, 4:14 AM
Michael
Michael - avatar
+ 2
def addition(x, y): return x+y n1 = int(input("Enter first number")) n2 = int(input("Enter second number")) print("Result: ", addition(n1, n2))
16th Aug 2017, 4:03 PM
noobcøder
noobcøder - avatar
+ 1
for inout of two numbers by user and then addition of that
13th Aug 2017, 3:37 AM
Šháśhïşh Míśhřä
Šháśhïşh Míśhřä - avatar
+ 1
thaks to all
13th Aug 2017, 5:29 AM
Šháśhïşh Míśhřä
Šháśhïşh Míśhřä - avatar
0
not working
13th Aug 2017, 3:36 AM
Šháśhïşh Míśhřä
Šháśhïşh Míśhřä - avatar