0% found this document useful (0 votes)
4 views2 pages

Salary and Marks Calculation Script

The document contains Python code for various calculations including gross salary, aggregate marks and percentage, Fibonacci series, factorial of a number, and reversing a number. Each section prompts the user for input and displays the calculated results. It demonstrates basic programming concepts and arithmetic operations.

Uploaded by

samm.muley
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Salary and Marks Calculation Script

The document contains Python code for various calculations including gross salary, aggregate marks and percentage, Fibonacci series, factorial of a number, and reversing a number. Each section prompts the user for input and displays the calculated results. It demonstrates basic programming concepts and arithmetic operations.

Uploaded by

samm.muley
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Name: Sarthak Amol Muley 25FC211

# Gross Salary Calculation

basic = float(input("Enter basic salary: "))

da = 0.5 * basic
hra = 0.2 * basic
gross_salary = basic + da + hra

print("Basic Salary:", basic)


print("Dearness Allowance (DA):", da)
print("House Rent Allowance (HRA):", hra)
print("Gross Salary:", gross_salary)

# Aggregate Marks & Percentage

m1 = int(input("Enter marks of subject 1: "))


m2 = int(input("Enter marks of subject 2: "))
m3 = int(input("Enter marks of subject 3: "))
m4 = int(input("Enter marks of subject 4: "))
m5 = int(input("Enter marks of subject 5: "))

aggregate = m1 + m2 + m3 + m4 + m5
percentage = (aggregate / 500) * 100

print("Aggregate Marks:", aggregate)


print("Percentage:", percentage)
Name: Sarthak Amol Muley 25FC211

# Fibonacci Series

n = int(input("Enter number of terms: "))

a=0
b=1

print("Fibonacci Series:")
for i in range(n):
print(a, end=" ")
next_term = a + b
a=b
b = next_term

# Factorial of a Number

num = int(input("Enter a number: "))

if num < 0:
print("Invalid input! Factorial is not defined for negative numbers.")
else:
fact = 1
for i in range(1, num + 1):
fact = fact * i
print("Factorial of", num, "is", fact)

# Reverse a Number
num = int(input("Enter a number: "))
reverse = 0

while num > 0:


digit = num % 10
reverse = reverse * 10 + digit
num = num // 10

print("Reversed number:", reverse)

You might also like