Simple addition program. : Console Read : Development : Python examples (example source code) Organized by topic

C++
PHP
Python
Python Home »  Development   » [  Console Read  ]  Screenshots 
 



Simple addition program.





# prompt the user for input
integer1 = raw_input"Enter first integer:\n" )  # read a string
integer1 = intinteger1 )                        # convert the string to an integer

integer2 = raw_input"Enter second integer:\n" # read a string
integer2 = intinteger2 )                        # convert the string to an integer

sum = integer1 + integer2                         # assignment of sum

print "Sum is", sum                               # print sum



           
       
Related examples in the same category
1.  Read numbers till eof and show squares Read numbers till eof and show squares
2.  Displaying location, type and value for your input. Displaying location, type and value for your input.
3.  Displaying location, type and value for an int Displaying location, type and value for an int
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.