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

Write a program to take two integers as input and output their sum.

This is my question. This program adds two numbers num1 = 1.5 num2 = 6.3 # Add two numbers sum = num1 + num2 # Display the sum print('The sum of {0} and {1} is {2}'.format(num1, num2, sum)). I used this method. And it shows incorrect. Tell me the crct method

17th Nov 2020, 12:29 PM
harini Sree
4 Answers
+ 8
num1 = 1.5 num2 = 6.3 sum = num1 + num2 print('The sum of {0} and {1} is {2}'.format(num1, num2, sum)) Your code is fine. But read the task and its expected output. It should be matched. Then only you can complete the task. You can't give inputs by yourself it should be asked Try it again Edit: harini Sree Can we see that code?
17th Nov 2020, 1:06 PM
Simba
Simba - avatar
+ 2
The question says ‚output the sum’ but you output a lot more. you should only output the sum, not anything else.
17th Nov 2020, 12:32 PM
John Doe
0
No it's just a sample I've given the correct input.
17th Nov 2020, 1:24 PM
harini Sree
0
reminds me of this: https://xkcd.com/221/
17th Nov 2020, 7:56 PM
John Doe