Write a program to take two integers as input and output their sum. Sample Input: 2 8 Sample Output: 10 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 4

Write a program to take two integers as input and output their sum. Sample Input: 2 8 Sample Output: 10

I cant get past this I'm confused pls help It keeps saying the output will be 9 Even tho i use 6 and 3 The above one is just an e.g

4th Nov 2020, 10:01 AM
David Solomon
David Solomon - avatar
53 Answers
+ 30
x=input() y=input() z=int(x)+int(y) print(z) After many attempt this is the answer for this question
29th Mar 2021, 7:33 AM
Jaatupoj Tuangsintaweekul
Jaatupoj Tuangsintaweekul - avatar
+ 9
Num1=int(input("enter first number:")) Num2=int(input ("enter second number:")) Sum=Num1+Num2 print ("your sum =",Sum) I hope you like it...:) Thank you guys..urs Pavan 👆👆👆👆
27th Nov 2020, 4:10 PM
Pavan Kumar
+ 5
okay a=int(input ()) b=int(input()) c=a+b Print (c)
6th Nov 2020, 7:28 AM
Abdullah Khalid
Abdullah Khalid - avatar
+ 5
# try this code of mine x = int(input()) y = int(input()) z = int(x + y) print(z)
16th May 2021, 2:36 AM
Mardin D. Maloloy-on
Mardin D. Maloloy-on - avatar
+ 4
The attempt of : x=int(input(first number)) y=int(input(second number)) z= x+y print(z) doesn‘t deliver the correct solution. Because input is resulting in a string number. Therefor the result is always going to be : xy e.g. x= int(input(6)) y= int(input(3)) z= x+y print(z) Result: 63 and not 9, which is wanted. So I would try it with the following: x= 6 x+= 3 print(x) which will result in the correct solution, which is 9.
20th Mar 2021, 11:56 AM
Ashley
+ 3
a=int(input()) b=int(input()) sum=a+b print(sum)
8th Jan 2021, 7:39 AM
Vijayanathan Menakan
Vijayanathan Menakan - avatar
+ 3
this correct's n1 = int(input()) n2 = int(input()) sum = n1+n2 print(sum)
2nd Feb 2021, 12:22 AM
Usman
Usman - avatar
+ 3
Num1=int(input()) Num2=int(input ()) Sum=Num1+Num2 print (Sum)
25th Sep 2021, 10:59 AM
Aya Benaziza
Aya Benaziza - avatar
+ 3
none of it was right
13th Oct 2021, 1:24 PM
Putinthom
+ 2
a=int(input()) b=int(input()) z=a+b print(z) Вай парни вы конечно тупите) и для виду фиговинок понаставлю ЭТ ТОЧНО РАБОТАЕТ ПРОВЕРЯЛ!ю.............................................
1st Apr 2021, 1:05 PM
Никита Бурлаков
Никита Бурлаков - avatar
+ 2
the correct answer is x=int(input()) y=int(input()) z=x+y print(z)
2nd Apr 2021, 11:43 AM
ANIKET SINGH
ANIKET SINGH - avatar
+ 2
x=int(input()) y=int(input()) print(x+y) make sure to use this it works
26th Sep 2021, 5:30 PM
Fabrone BITITI
Fabrone BITITI - avatar
+ 2
# your code goes here a = int(input()) b = int(input()) c = a + b print(c) Try and learn
3rd Oct 2021, 8:23 AM
HARSHIL RAMANI
HARSHIL RAMANI - avatar
+ 1
What have you tried? it's really a basic question that you can even Google and will give you an idea about how to solve it or maybe the solution to it ,
4th Nov 2020, 10:03 AM
Abhay
Abhay - avatar
+ 1
I have attempted it abhay i still cant figure it out
4th Nov 2020, 10:12 AM
David Solomon
David Solomon - avatar
+ 1
I've solved it thank you all The mistake I was making was putting in the value i should have just left it blank
4th Nov 2020, 7:51 PM
David Solomon
David Solomon - avatar
+ 1
n1 = int(input()) n2 = int(input()) sum = n1+n2 print(sum)
5th Nov 2020, 12:59 PM
Aditya
Aditya - avatar
+ 1
Solution of your question: # take a variable and use input function and also use type casting(convert str data type in int) num_one = int(input("Enter Your First Number: )) num1_two = int(input("Enter Your Seconed Number: )) sum_of_nums = num_one + num1_two print(sum_of_nums)
6th Nov 2020, 5:01 AM
Faisal Nawaz
Faisal Nawaz - avatar
+ 1
Num1=int(input("enter first number:")) Num2=int(input ("enter second number:")) Sum=Num1+Num2 print ("your sum =",Sum) I hope you like it...:) Thank you guys..urs Pavan
6th Nov 2020, 7:02 AM
Pavan Kumar
+ 1
x=input() y=input() z=int(x)+int(y) print (z)
28th Jul 2022, 7:12 PM
RAYUDU BHANU VENKATA SIVA TEJA
RAYUDU BHANU VENKATA SIVA TEJA - avatar