Skip to content

Commit 88f5c9f

Browse files
Merge pull request #4 from CCAtAlvis/master
implemented adding two numbers in python program
2 parents 62ed230 + 610b815 commit 88f5c9f

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

SimpleAddition/Sum_2_numbers.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1-
a=int(input())
2-
b=int(input())
31

4-
Sum=a+b
5-
print (Sum)
2+
# first lets get 2 numbers to add
3+
print "enter 2 number to add"
4+
5+
# getting the first number
6+
number1 = raw_input("Ok enter the first number ")
7+
8+
# and now the second number
9+
number2 = raw_input("and now the second number ")
10+
11+
# finally calculating the addidition of the numbers
12+
# sum = number1 + number2
13+
# seems to be right
14+
# but as the inputs are taken as string we need to type cast them
15+
# that is convert number1 and number2 to integer from string
16+
# so lets do that
17+
18+
number1 = int(number1)
19+
number2 = int(number2)
20+
# and now lets calculate the sum
21+
sum = number1 + number2
22+
23+
# and now lets print the numbers
24+
print "the addition of the 2 numbers is "
25+
print sum
26+

0 commit comments

Comments
 (0)