Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 751 Bytes

File metadata and controls

33 lines (24 loc) · 751 Bytes

Python Programs: Factorial and Math Calculations

Task 1: Factorial Using a Function

  • This program asks the user to enter a number.
  • It calculates the factorial using a function and prints the result.

Example Output:

Enter a number: 5 Factorial of 5 is : 120

Task 2: Math Calculations Using math Module

  • This program asks the user to enter a number.
  • It uses the math module to calculate:
    • Square root
    • Natural logarithm
    • Sine (in radians)

Example Output:

Enter a number: 25 Square root: 5.0 Logarithm: 3.2188758248682006 Sine: -0.13235175009777303


How to Run

  1. Make sure Python is installed.
  2. Save the code in .py files (example: factorial-using-func.py, math-module.py).
  3. Run the files.