Hello!! Can someone please tell me how to write an algorithm for adding two input numbers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Hello!! Can someone please tell me how to write an algorithm for adding two input numbers?

21st Apr 2021, 9:52 PM
Tony Matar
53 Answers
+ 10
n1 = int(input()) n2 = int(input()) print(n1 + n2)
22nd Apr 2021, 3:45 PM
Adarsh Addee
Adarsh Addee - avatar
+ 3
you made a few mistakes: all statements must start with a small letter. when you declare a variable and assign it an input, you don't need to write anything inside, remove the quotation marks from there, too. immediately convert this value to an integer. do not immediately print the entered value to the screen. perform an arithmetic operation on two numbers and display the result on the screen
21st Apr 2021, 10:11 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
Yeahh i did ittt
21st Apr 2021, 10:33 PM
Tony Matar
+ 2
you wrote quite a working program, but alas, the requirements of the tests are different and we must follow them. from now on, read the task carefully and do everything literally. right down to the output of each word. if the word should be capitalized - type with a capital letter. no personal interpretations. this is a guarantee of success
21st Apr 2021, 10:38 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
Thanks for your advice
21st Apr 2021, 10:40 PM
Tony Matar
+ 2
good luck and happy coding!
21st Apr 2021, 10:41 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
Step 1: Start Step 2: Assign two numbers A and B Step 3: Sum of A and B is C Step 4: Add A and B Step 5: Print the value of C Step 6: Stop
23rd Apr 2021, 6:44 PM
Minotic
Minotic - avatar
+ 1
Hi! What exactly is your problem?
21st Apr 2021, 9:59 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Write a program to take two integers as input and output their sum. Sample Input: 2 8 Sample Output: 10
21st Apr 2021, 10:01 PM
Tony Matar
+ 1
I wrote : Input1=input('first number:') Print(Input1) Input2=input('second number:') Print(Input2) Print(int(Input1) +int(Input2))
21st Apr 2021, 10:05 PM
Tony Matar
+ 1
at what stage did you have a problem? have you tried writing code? can you show it off?
21st Apr 2021, 10:05 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
I put int() cz i want to add the two numbers as quantities and not as strings
21st Apr 2021, 10:06 PM
Tony Matar
+ 1
OKayy thnxx
21st Apr 2021, 10:13 PM
Tony Matar
+ 1
I would be delighted if you write me the operation and the steps so i can clearly see where am wrong
21st Apr 2021, 10:17 PM
Tony Matar
+ 1
In fact i am learning python just for fun and for knowledge though i am a biology masters student :pp
21st Apr 2021, 10:18 PM
Tony Matar
+ 1
haha, my specialty is agronomist for plant protection, although I work as an engineer for the installation of security and fire alarms, video surveillance
21st Apr 2021, 10:21 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Ahh cooll!!
21st Apr 2021, 10:22 PM
Tony Matar
+ 1
I checked your code, it was not so bad
21st Apr 2021, 10:22 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
What code??
21st Apr 2021, 10:23 PM
Tony Matar