Program-From-1 to 5
Program-From-1 to 5
Write a program to input three angles of a triangle and check whether a triangle is possible or not. If possible then
check whether it is an acute-angled triangle, right-angled or an obtuse-angled triangle otherwise, display 'Triangle
not possible'.
a, b, c = angle_list
# Check if triangle is possible: sum of angles must be 180 and each angle > 0
if a == 90 or b == 90 or c == 90:
print("Right-angled Triangle")
print("Acute-angled Triangle")
else:
print("Obtuse-angled Triangle")
else:
Question 2
Write a program to input the cost price and the selling price of an article.
If the selling price is more than the cost price then calculate and display actual profit and
profit per cent otherwise, calculate and display actual loss and loss per cent.
If the cost price and the selling price are equal, the program displays the message 'Neither profit nor loss'.
# Input cost price and selling price from the user
cost_price = float(input("Enter the cost price: "))
selling_price = float(input("Enter the selling price: "))
Question 3
Write a program to input three numbers and check whether they are equal or not.
If they are unequal numbers then display the greatest among them otherwise, display the message 'All the numbers
are equal'.
Question 4
Write a program to accept a number and check whether the number is divisible by 3 as well as 5. Otherwise, decide:
Question 5
(a) a Leap year (b) a Century Leap year (c) a Century year but not a Leap year