Sunday, February 7, 2016

Basic Math Operations in Python

This is a simple program that I wrote using Python as my programming language that program will ask the user to give two numbers and then our program will find the sum, difference, product and quotient of the two numbers that is being provided by our end user of the program. I am still a beginner in Python programming but I find Python an easy to learn programming language.

If you have some questions please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

print('\n')
print('\t Basic Math Operations in Python')
print('\n')
first_value  = int(input('Enter first  value : '))
second_value = int(input('Enter second value : '))

addtion = (first_value + second_value)
subtraction = (first_value - second_value)
product = (first_value * second_value)
division = (first_value / second_value);

print('\n')
print("The sum of {0} and {1} is {2} .".format(first_value,second_value,addtion)."\n");
print("The difference between {0} and {1} is {2} .".format(first_value,second_value,subtraction)."\n");
print("The product of {0} and {1} is {2} .".format(first_value,second_value,product)."\n");
print("The quotient of {0} and {1} is {2} .".format(first_value,second_value,division)."\n");
print('\n')
print('Thank you for using this program')





No comments:

Post a Comment