Python - Add Two Decimal Numbers
Here is the python source code to add two floating point numbers. This code is tested with Python version 2.6
print "Program to add two floating point numbers" print "Enter First Number:", c = 0.0 c = input() print "Enter Second Number:", d = 0.0 d = input() e = 0.0 e = c + d print "Result: $.4f" %e #sample output #Program to add two floating point numbers #Enter First Number: 1.111 #Enter Second Number: 2.222 #Result: 3.3330
|