Python Program Collection 04 - Calculate Simple Interest, Profit, Loss, Profit/Loss Percentage
43. Display simple interest
principal = float(input("Enter the
Principal amount: "))
time = float(input("Enter the Time (in
years): "))
rate = float(input("Enter the Rate of
Interest (% per annum): "))
simple_interest = (principal * time * rate) /
100
print("The Simple Interest is:",
simple_interest)
44. Input principal, rate, time and display
total amount.
principal = float(input("Enter the
Principal amount: "))
time = float(input("Enter the Time (in
years): "))
rate = float(input("Enter the Rate of
Interest (% per annum): "))
simple_interest = (principal * time * rate) /
100
total_amount = principal + simple_interest
print("The Total Amount (Principal +
Interest) is:", total_amount)
45. Input principal, rate, time and display
simple interest and total amount.
principal = float(input("Enter the
Principal amount: "))
time = float(input("Enter the Time (in
years): "))
rate = float(input("Enter the Rate of
Interest (% per annum): "))
simple_interest = (principal * time * rate) /
100
total_amount = principal + simple_interest
print("The Simple Interest is:",
simple_interest)
print("The Total Amount (Principal +
Interest) is:", total_amount)
46. Input amount, rate, time and display
principal.
amount = float(input("Enter the Total
Amount: "))
rate = float(input("Enter the Rate of
Interest (% per annum): "))
time = float(input("Enter the Time (in
years): "))
principal = amount / (1 + (rate * time) / 100)
print("The Principal is:",
principal)
47. Input simple interest, rate, time and
display principal.
simple_interest = float(input("Enter the
Simple Interest: "))
rate = float(input("Enter the Rate of
Interest (% per annum): "))
time = float(input("Enter the Time (in
years): "))
principal = (simple_interest * 100) / (rate *
time)
print("The Principal is:",
principal)
48. Calculate profit
cp = float(input("Enter the Cost Price
(CP): "))
sp = float(input("Enter the Selling Price
(SP): "))
profit = sp - cp
print("The Profit is:", profit)
49. Calculate loss
cp = float(input("Enter the Cost Price
(CP): "))
sp = float(input("Enter the Selling Price
(SP): "))
loss = cp - sp
print("The Loss is:", loss)
50E. Python Program (Profit or Loss
Calculator)
cp = float(input("Enter the Cost Price
(CP): "))
sp = float(input("Enter the Selling Price
(SP): "))
if sp > cp:
profit = sp - cp
print("Profit =", profit)
elif cp > sp:
loss
= cp - sp
print("Loss =", loss)
else:
print("No Profit, No Loss")
50. Calculate profit percentage
cp = float(input("Enter the Cost Price
(CP): "))
sp = float(input("Enter the Selling Price
(SP): "))
profit = sp - cp
profit_percent = (profit / cp) * 100
print("Profit =", profit)
print("Profit Percentage =",
profit_percent, "%")
51. Calculate loss percentage
cp = float(input("Enter the Cost Price
(CP): "))
sp = float(input("Enter the Selling Price
(SP): "))
loss = cp - sp
loss_percent = (loss / cp) * 100
print("Loss =", loss)
print("Loss Percentage =",
loss_percent, "%")
51E. Python Program (Profit or Loss
Percentage)
cp = float(input("Enter the Cost Price
(CP): "))
sp = float(input("Enter the Selling Price
(SP): "))
if sp > cp:
profit = sp - cp
profit_percent = (profit / cp) * 100
print("Profit =", profit)
print("Profit Percentage =", profit_percent, "%")
elif cp > sp:
loss
= cp - sp
loss_percent = (loss / cp) * 100
print("Loss =", loss)
print("Loss Percentage =", loss_percent, "%")
else:
print("No Profit, No Loss")
52. Calculate selling price where
profit percentage and cost price is given
cp = float(input("Enter the Cost Price
(CP): "))
profit_percent = float(input("Enter the
Profit Percentage: "))
sp = cp * (1 + profit_percent / 100)
print("The Selling Price (SP) is:",
sp)
53. Calculate selling price where
loss percentage and cost price is given
cp = float(input("Enter the Cost Price
(CP): "))
loss_percent = float(input("Enter the
Loss Percentage: "))
sp = cp * (1 - loss_percent / 100)
print("The Selling Price (SP) is:",
sp)
54. Calculate cost price where loss
percentage and selling price is given
sp = float(input("Enter the Selling Price
(SP): "))
loss_percent = float(input("Enter the
Loss Percentage: "))
cp = sp / (1 - loss_percent / 100)
print("The Cost Price (CP) is:", cp)
55. Calculate cost price where
profit percentage and selling price is given
sp = float(input("Enter the Selling Price
(SP): "))
profit_percent = float(input("Enter the
Profit Percentage: "))
cp = sp / (1 + profit_percent / 100)
print("The Cost Price (CP) is:", cp)
No comments:
Post a Comment