Tuesday, April 23, 2019

Math Converter in Python

 A menu driven program that has the follow mathematics conversion
area of the triangle, height in centimeter to feet and inches, find lcm of two numbers, sum of first n natural numbers and calculate the simple interest and display the result on the screen using Python programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

# Rollyn M. Moises and Jake R. Pomperada
# calculator.py
# February 6, 2019  Wednesday
# Bacolod City, Negros Occidental

import math
print();
print("\tMATH CONVERTERS");
print();
print("\t[1] Area of the Triangle");
print("\t[2] Height in Centimeter to Feet and Inches");
print("\t[3] Find LCM of Two Numbers ");
print("\t[4] Sum of First n Natural Numbers");
print("\t[5] Calculate the Simple Interest");
print();
ch=input("\tSelect Your Choice : ")
print();
if(ch=="1"):
    a = int(input("\tEnter first side: "))
    b = int(input("\tEnter second side: "))
    c = int(input("\tEnter third side: "))
    s = (a + b + c) / 2
    area = math.sqrt(s * (s - a) * (s - b) * (s - c))
    print("\tArea of the triangle is: ", round(area, 2))
elif(ch=="2"):
    cm = int(input("\tEnter the height in centimeters:"))
    inches = 0.394 * cm
    feet = 0.0328 * cm
    print("\tThe length in inches", round(inches, 2))
    print("\tThe length in feet", round(feet, 2))
elif(ch=="3"):
    a = int(input("\tEnter the first number:"))
    b = int(input("\tEnter the second number:"))
    if (a > b):
        min1 = a
    else:
        min1 = b
    while (1):
        if (min1 % a == 0 and min1 % b == 0):
           print("\tThe LCM is:", min1)
           break
        min1 = min1 + 1;
elif(ch=="4"):
    n = int(input("\tEnter a number: "))
    sum1 = 0
    while (n > 0):
        sum1 = sum1 + n
        n = n - 1
    print("\tThe sum of first n natural numbers is", sum1)
elif (ch == "5"):
    principle = float(input("\tEnter the principle amount:"))
    time = int(input("\tEnter the time(years):"))
    rate = float(input("\tEnter the rate:"))
    simple_interest = (principle * time * rate) / 100
    print("\tThe simple interest is:", round(simple_interest,2));
else:
    print("\tInvalid Operator. Try Again")
print();
print("\tEND OF PROGRAM");

No comments:

Post a Comment