SCIENTIFIC CALCULATOR USING PYTHON
----------------------------------
AIM:
The aim of this project is to design and implement a Scientific Calculator using
Python to perform arithmetic and scientific calculations.
DESCRIPTION:
This project is a menu-driven Scientific Calculator developed using Python. It
uses functions, loops, conditional statements, and the math module to
perform various mathematical operations such as addition, subtraction,
multiplication, division, square, square root, power, logarithm, sine, cosine,and
tangent.
SOURCE CODE:
import math
print("----------------------------------")
print(" SCIENTIFIC CALCULATOR SYSTEM ")
print("----------------------------------")
while True:
print("\n1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
print("5. Square")
print("6. Square Root")
print("7. Power")
print("8. Logarithm")
print("9. Sine")
print("10. Cosine")
print("11. Tangent")
print("12. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
print("Result =", a + b)
elif choice == 2:
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
print("Result =", a - b)
elif choice == 3:
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
print("Result =", a * b)
elif choice == 4:
a = float(input("Enter numerator: "))
b = float(input("Enter denominator: "))
if b != 0:
print("Result =", a / b)
else:
print("Division by zero error")
elif choice == 5:
a = float(input("Enter a number: "))
print("Square =", a * a)
elif choice == 6:
a = float(input("Enter a number: "))
print("Square Root =", [Link](a))
elif choice == 7:
a = float(input("Enter base: "))
b = float(input("Enter power: "))
print("Result =", [Link](a, b))
elif choice == 8:
a = float(input("Enter a number: "))
print("Logarithm =", math.log10(a))
elif choice == 9:
a = float(input("Enter angle in degrees: "))
print("Sine =", [Link]([Link](a)))
elif choice == 10:
a = float(input("Enter angle in degrees: "))
print("Cosine =", [Link]([Link](a)))
elif choice == 11:
a = float(input("Enter angle in degrees: "))
print("Tangent =", [Link]([Link](a)))
elif choice == 12:
print("Thank you for using Scientific Calculator")
break
else:
print("Invalid choice")
OUTPUT:
The program displays a menu-driven calculator and performs all selected
operations correctly.