Computer Science HW 1
Computer Science HW 1
HW - 1
Source Code:
if(Y%4==0):
print('It is a leap year!')
else:
print('It is NOT a leap year!')
Output Screenshot:
Program 2: Quadratic Equations
Source Code:
A = float(input('Enter A:'))
B = float(input('Enter B:'))
C = float(input('Enter C:'))
D = B*B-4*A*C
if(D<0):
print('Roots are NOT Real - Imaginary')
elif(D==0):
print('Roots are Real and Equal')
else:
print('Roots are Real and Distinct')
print(D)
Output Screenshot:
Program 3: Sides of a Triangle
Source Code:
if A == B == C:
print('It is an Equilateral Triangle.')
elif A == B or B == C or A == C:
print('It is an Isosceles Triangle')
elif A**2 == B**2 + C**2 or B**2 == A**2 + C**2 or C**2 ==
A**2 + B**2:
print('It is a Right Angled Triangle')
else:
print('It is a Scalene Triangle')
Output Screenshot: