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
- 1

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

I cannot write a program as given in question.

27th May 2021, 4:12 PM
Siddhartha Kushwaha
Siddhartha Kushwaha - avatar
11 Answers
+ 1
Use "+" to add 2 numbers input() to take input int() to convert string input to int.
27th May 2021, 4:14 PM
TOLUENE
TOLUENE - avatar
+ 1
Siddhartha Kushwaha you need to try at least something . If we provide you full codes you won't be able to learn that topic.
27th May 2021, 4:17 PM
TOLUENE
TOLUENE - avatar
+ 1
En la leccion de python core se explica el funcionamiento dela función input(), de la misma manera explican varios ejemplos relacionados a tu pregunta: https://code.sololearn.com/cDT0hK31LAC1/?ref=app https://code.sololearn.com/c4L15Ps6nd4l/?ref=app https://code.sololearn.com/c6idvGjOgVoC/?ref=app https://code.sololearn.com/cJcv9Gqt2v8k/?ref=app
27th May 2021, 5:18 PM
Cmurio
Cmurio - avatar
0
Can you write full code please??🙏🏻🙏🏻
27th May 2021, 4:16 PM
Siddhartha Kushwaha
Siddhartha Kushwaha - avatar
0
Please post your attempt
27th May 2021, 4:16 PM
Eashan Morajkar
Eashan Morajkar - avatar
0
product= int(input(2))+ int(input(8)) print(product) # I wrote this.
27th May 2021, 4:19 PM
Siddhartha Kushwaha
Siddhartha Kushwaha - avatar
0
A very short format print(int(input())+int(input()))
27th May 2021, 4:20 PM
Eashan Morajkar
Eashan Morajkar - avatar
0
I tried so many times😞😞
27th May 2021, 4:20 PM
Siddhartha Kushwaha
Siddhartha Kushwaha - avatar
0
Why your code doesn't work is because of the numbers in the input function
27th May 2021, 4:21 PM
Eashan Morajkar
Eashan Morajkar - avatar
0
Can you write full code??🙏🏻🙏🏻
27th May 2021, 4:23 PM
Siddhartha Kushwaha
Siddhartha Kushwaha - avatar
0
# your corrected code: product= int(input())+ int(input()) print(product) # your code was only failing because input take an argument used to be printed before asking input to user, and test doesn't expect you print anything else than the result ;)
27th May 2021, 4:40 PM
visph
visph - avatar